niagara2.c revision 4496171313bed39e96f21bc2f9faf2868e267ae3
4496171313bed39e96f21bc2f9faf2868e267ae3girish * CDDL HEADER START
4496171313bed39e96f21bc2f9faf2868e267ae3girish * The contents of this file are subject to the terms of the
4496171313bed39e96f21bc2f9faf2868e267ae3girish * Common Development and Distribution License (the "License").
4496171313bed39e96f21bc2f9faf2868e267ae3girish * You may not use this file except in compliance with the License.
4496171313bed39e96f21bc2f9faf2868e267ae3girish * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
4496171313bed39e96f21bc2f9faf2868e267ae3girish * See the License for the specific language governing permissions
4496171313bed39e96f21bc2f9faf2868e267ae3girish * and limitations under the License.
4496171313bed39e96f21bc2f9faf2868e267ae3girish * When distributing Covered Code, include this CDDL HEADER in each
4496171313bed39e96f21bc2f9faf2868e267ae3girish * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
4496171313bed39e96f21bc2f9faf2868e267ae3girish * If applicable, add the following below this CDDL HEADER, with the
4496171313bed39e96f21bc2f9faf2868e267ae3girish * fields enclosed by brackets "[]" replaced with your own identifying
4496171313bed39e96f21bc2f9faf2868e267ae3girish * information: Portions Copyright [yyyy] [name of copyright owner]
4496171313bed39e96f21bc2f9faf2868e267ae3girish * CDDL HEADER END
4496171313bed39e96f21bc2f9faf2868e267ae3girish * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
4496171313bed39e96f21bc2f9faf2868e267ae3girish * Use is subject to license terms.
4496171313bed39e96f21bc2f9faf2868e267ae3girish#pragma ident "%Z%%M% %I% %E% SMI"
4496171313bed39e96f21bc2f9faf2868e267ae3girish * Hypervisor services information for the NIAGARA2 CPU module
4496171313bed39e96f21bc2f9faf2868e267ae3girishstatic uint64_t niagara2_sup_minor; /* Supported minor number */
4496171313bed39e96f21bc2f9faf2868e267ae3girish HSVC_REV_1, NULL, HSVC_GROUP_NIAGARA2_CPU, NIAGARA2_HSVC_MAJOR,
4496171313bed39e96f21bc2f9faf2868e267ae3girish * Negotiate the API version for Niagara2 specific hypervisor
4496171313bed39e96f21bc2f9faf2868e267ae3girish * services.
4496171313bed39e96f21bc2f9faf2868e267ae3girish status = hsvc_register(&niagara2_hsvc, &niagara2_sup_minor);
4496171313bed39e96f21bc2f9faf2868e267ae3girish if (status != 0) {
4496171313bed39e96f21bc2f9faf2868e267ae3girish cmn_err(CE_WARN, "%s: cannot negotiate hypervisor services "
4496171313bed39e96f21bc2f9faf2868e267ae3girish "group: 0x%lx major: 0x%lx minor: 0x%lx errno: %d",
4496171313bed39e96f21bc2f9faf2868e267ae3girish niagara2_hsvc.hsvc_modname, niagara2_hsvc.hsvc_group,
4496171313bed39e96f21bc2f9faf2868e267ae3girish niagara2_hsvc.hsvc_major, niagara2_hsvc.hsvc_minor, status);
4496171313bed39e96f21bc2f9faf2868e267ae3girish * The setup common to all CPU modules is done in cpu_setup_common
4496171313bed39e96f21bc2f9faf2868e267ae3girish " does not have required sun4v page sizes"
4496171313bed39e96f21bc2f9faf2868e267ae3girish " 8K, 64K and 4M: MD mask is 0x%x",
4496171313bed39e96f21bc2f9faf2868e267ae3girish cpu_hwcap_flags = AV_SPARC_VIS | AV_SPARC_VIS2 | AV_SPARC_ASI_BLK_INIT;
4496171313bed39e96f21bc2f9faf2868e267ae3girish * Niagara2 supports a 48-bit subset of the full 64-bit virtual
4496171313bed39e96f21bc2f9faf2868e267ae3girish * address space. Virtual addresses between 0x0000800000000000
4496171313bed39e96f21bc2f9faf2868e267ae3girish * and 0xffff.7fff.ffff.ffff inclusive lie within a "VA Hole"
4496171313bed39e96f21bc2f9faf2868e267ae3girish * and must never be mapped. In addition, software must not use
4496171313bed39e96f21bc2f9faf2868e267ae3girish * pages within 4GB of the VA hole as instruction pages to
4496171313bed39e96f21bc2f9faf2868e267ae3girish * avoid problems with prefetching into the VA hole.
4496171313bed39e96f21bc2f9faf2868e267ae3girish hole_start = (caddr_t)((1ull << (va_bits - 1)) - (1ull << 32));
4496171313bed39e96f21bc2f9faf2868e267ae3girish hole_end = (caddr_t)((0ull - (1ull << (va_bits - 1))) + (1ull << 32));
4496171313bed39e96f21bc2f9faf2868e267ae3girish * Niagara2 has a performance counter overflow interrupt
4496171313bed39e96f21bc2f9faf2868e267ae3girish * Set the magic constants of the implementation.
4496171313bed39e96f21bc2f9faf2868e267ae3girish * The Cache node is optional in MD. Therefore in case "Cache"
4496171313bed39e96f21bc2f9faf2868e267ae3girish * node does not exists in MD, set the default L2 cache associativity,
4496171313bed39e96f21bc2f9faf2868e267ae3girish * size, linesize.
4496171313bed39e96f21bc2f9faf2868e267ae3girish cpunode->ecache_associativity = L2CACHE_ASSOCIATIVITY;
4496171313bed39e96f21bc2f9faf2868e267ae3girish extern int niagara_kstat_init(void);
4496171313bed39e96f21bc2f9faf2868e267ae3girish * The cpu_ipipe field is initialized based on the execution
4496171313bed39e96f21bc2f9faf2868e267ae3girish * unit sharing information from the MD. It defaults to the
4496171313bed39e96f21bc2f9faf2868e267ae3girish * virtual CPU id in the absence of such information.
4496171313bed39e96f21bc2f9faf2868e267ae3girish cp->cpu_m.cpu_ipipe = cpunodes[cp->cpu_id].exec_unit_mapping;
4496171313bed39e96f21bc2f9faf2868e267ae3girish if ((niagara2_cpucnt++ == 0) && (niagara2_hsvc_available == B_TRUE))
4496171313bed39e96f21bc2f9faf2868e267ae3girish/*ARGSUSED*/
4496171313bed39e96f21bc2f9faf2868e267ae3girish extern int niagara_kstat_fini(void);
4496171313bed39e96f21bc2f9faf2868e267ae3girish if ((--niagara2_cpucnt == 0) && (niagara2_hsvc_available == B_TRUE))
4496171313bed39e96f21bc2f9faf2868e267ae3girish * On Niagara2, any flush will cause all preceding stores to be
4496171313bed39e96f21bc2f9faf2868e267ae3girish * synchronized wrt the i$, regardless of address or ASI. In fact,
4496171313bed39e96f21bc2f9faf2868e267ae3girish * the address is ignored, so we always flush address 0.
4496171313bed39e96f21bc2f9faf2868e267ae3girish/*ARGSUSED*/
4496171313bed39e96f21bc2f9faf2868e267ae3girish * Trapstat support for Niagara2 processor
4496171313bed39e96f21bc2f9faf2868e267ae3girish * The Niagara2 provides HWTW support for TSB lookup and with HWTW
4496171313bed39e96f21bc2f9faf2868e267ae3girish * enabled no TSB hit information will be available. Therefore setting
4496171313bed39e96f21bc2f9faf2868e267ae3girish * the time spent in TLB miss handler for TSB hits to 0.
4496171313bed39e96f21bc2f9faf2868e267ae3girish tstatp->tpgsz_kernel.tmode_itlb.ttlb_tlb.tmiss_count = 0;
4496171313bed39e96f21bc2f9faf2868e267ae3girish tstatp->tpgsz_kernel.tmode_itlb.ttlb_tlb.tmiss_time = 0;
4496171313bed39e96f21bc2f9faf2868e267ae3girish tstatp->tpgsz_user.tmode_itlb.ttlb_tlb.tmiss_count = 0;
4496171313bed39e96f21bc2f9faf2868e267ae3girish tstatp->tpgsz_user.tmode_itlb.ttlb_tlb.tmiss_time = 0;
4496171313bed39e96f21bc2f9faf2868e267ae3girish tstatp->tpgsz_kernel.tmode_dtlb.ttlb_tlb.tmiss_count = 0;
4496171313bed39e96f21bc2f9faf2868e267ae3girish tstatp->tpgsz_kernel.tmode_dtlb.ttlb_tlb.tmiss_time = 0;
4496171313bed39e96f21bc2f9faf2868e267ae3girish tstatp->tpgsz_user.tmode_dtlb.ttlb_tlb.tmiss_count = 0;