From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Egger Subject: Re: [PATCH] nestedhvm: ASID emulation (cleanup) Date: Wed, 13 Apr 2011 15:49:36 +0200 Message-ID: <4DA5A9F0.4050001@amd.com> References: <201104131520.23648.Christoph.Egger@amd.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------070409060700090801020508" Return-path: In-Reply-To: <201104131520.23648.Christoph.Egger@amd.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "xen-devel@lists.xensource.com" Cc: Keir Fraser List-Id: xen-devel@lists.xenproject.org --------------070409060700090801020508 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit On 04/13/11 15:20, Christoph Egger wrote: > On Wednesday 13 April 2011 15:06:43 Keir Fraser wrote: >> On 13/04/2011 11:35, "Christoph Egger" wrote: >>> Cleanup for ASID emulation: >>> - Use C99 integer types for asid numbers >>> >>> - asid.c: consistently use 'v' instead of 'curr' >> >> On what planet is that an improvement?? >> >> We use 'curr' as a convenient idiom to represent cached current. Whereas >> 'v' is supposed to represent an arbitrary vcpu. > > Oh, that's the difference. I thought 'curr' is just another random name for an > arbitrary vcpu. > > I will resend the patch w/o that hunk. > >> >> I know it costs three extra characters per use, but it does make code >> easier to understand. >> >> -- Keir >> >>> - Introduce svm_invlpga() used in ASID emulation patch >>> >>> Signed-off-by: Christoph Egger Here we go. Cleanup for ASID emulation: - Use C99 integer types for asid numbers - Introduce svm_invlpga() used in ASID emulation patch Signed-off-by: Christoph Egger -- ---to satisfy European Law for business letters: Advanced Micro Devices GmbH Einsteinring 24, 85689 Dornach b. Muenchen Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen Registergericht Muenchen, HRB Nr. 43632 --------------070409060700090801020508 Content-Type: text/plain; name="xen_nh_asid_cleanup.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="xen_nh_asid_cleanup.diff" Content-Description: xen_nh_asid_cleanup.diff diff -r d1677c0438fb -r 5458a9862db2 xen/arch/x86/hvm/asid.c --- a/xen/arch/x86/hvm/asid.c +++ b/xen/arch/x86/hvm/asid.c @@ -48,9 +48,9 @@ /* Per-CPU ASID management. */ struct hvm_asid_data { - u64 core_asid_generation; - u32 next_asid; - u32 max_asid; + uint64_t core_asid_generation; + uint32_t next_asid; + uint32_t max_asid; bool_t disabled; }; @@ -58,7 +58,7 @@ static DEFINE_PER_CPU(struct hvm_asid_da void hvm_asid_init(int nasids) { - static s8 g_disabled = -1; + static int8_t g_disabled = -1; struct hvm_asid_data *data = &this_cpu(hvm_asid_data); data->max_asid = nasids - 1; diff -r d1677c0438fb -r 5458a9862db2 xen/include/asm-x86/hvm/svm/asid.h --- a/xen/include/asm-x86/hvm/svm/asid.h +++ b/xen/include/asm-x86/hvm/svm/asid.h @@ -34,10 +34,7 @@ static inline void svm_asid_g_invlpg(str { #if 0 /* Optimization? */ - asm volatile (".byte 0x0F,0x01,0xDF \n" - : /* output */ - : /* input */ - "a" (g_vaddr), "c"(v->arch.hvm_svm.vmcb->guest_asid) ); + svm_invlpga(g_vaddr, v->arch.hvm_svm.vmcb->guest_asid); #endif /* Safe fallback. Take a new ASID. */ diff -r d1677c0438fb -r 5458a9862db2 xen/include/asm-x86/hvm/svm/svm.h --- a/xen/include/asm-x86/hvm/svm/svm.h +++ b/xen/include/asm-x86/hvm/svm/svm.h @@ -60,6 +60,15 @@ static inline void svm_vmsave(void *vmcb : : "a" (__pa(vmcb)) : "memory" ); } +static inline void svm_invlpga(unsigned long vaddr, uint32_t asid) +{ + asm volatile ( + ".byte 0x0f,0x01,0xdf" + : /* output */ + : /* input */ + "a" (vaddr), "c" (asid)); +} + unsigned long *svm_msrbit(unsigned long *msr_bitmap, uint32_t msr); void __update_guest_eip(struct cpu_user_regs *regs, unsigned int inst_len); diff -r d1677c0438fb -r 5458a9862db2 xen/include/asm-x86/hvm/vcpu.h --- a/xen/include/asm-x86/hvm/vcpu.h +++ b/xen/include/asm-x86/hvm/vcpu.h @@ -100,8 +100,8 @@ struct hvm_vcpu { bool_t hcall_preempted; bool_t hcall_64bit; - u64 asid_generation; - u32 asid; + uint64_t asid_generation; + uint32_t asid; u32 msr_tsc_aux; --------------070409060700090801020508 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --------------070409060700090801020508--