From patchwork Tue Dec 3 17:27:51 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 21994 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f199.google.com (mail-ob0-f199.google.com [209.85.214.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6F6D7202AE for ; Tue, 3 Dec 2013 17:27:56 +0000 (UTC) Received: by mail-ob0-f199.google.com with SMTP id gq1sf46878489obb.10 for ; Tue, 03 Dec 2013 09:27:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:message-id:subject:from:to:cc:date :in-reply-to:references:organization:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe:content-type :content-transfer-encoding; bh=v9gRLVfnlACvjhb6d21vtZnoKJ7lKnbNLJPm9Z4Rr1I=; b=Hn5+I04qAaTX+Bp1m8fJWUkCEk+N7vo38Cu2wjvZzwHZXtSzMdEiIzoylfBPr3i2rG IXeYx1HPkX0kTs1xcE1scS1fguHOPM5FVhrOqkYIpz8/yx7+8QwlmBSb58mps4kcIldi o3EkEJ7/PEjx85ZoX0BHBW10UcCFe414tjbo3g4oPwUqfgS9s9wfStpC7v+Y/zp8xQtP 5kwQ1r7pFQKHw5Vb8eiqgt1L8bI4mQAUYyGZJV/pZ7nXqV87/j0gYbLBHBXA3YUJEqd+ mm+5h+BFfjuAE8944jUPnOdmIxUnfTIjGXCIza5IpddGTZr2AQgU/KVhPqCMylSELLNa jV0g== X-Gm-Message-State: ALoCoQlG0zdwWKvaHrMEmu14HmRWO55w+SpwpgBPLS71tOR/72mQwKuc2ufZYy0b9pNnwM1x755B X-Received: by 10.42.98.81 with SMTP id r17mr19343528icn.8.1386091676045; Tue, 03 Dec 2013 09:27:56 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.0.174 with SMTP id 14ls2953091qef.5.gmail; Tue, 03 Dec 2013 09:27:55 -0800 (PST) X-Received: by 10.220.144.80 with SMTP id y16mr56672765vcu.4.1386091675886; Tue, 03 Dec 2013 09:27:55 -0800 (PST) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by mx.google.com with ESMTPS id gw1si31641913vcb.62.2013.12.03.09.27.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Dec 2013 09:27:55 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.177; Received: by mail-vc0-f177.google.com with SMTP id hv10so9916156vcb.22 for ; Tue, 03 Dec 2013 09:27:55 -0800 (PST) X-Received: by 10.52.98.194 with SMTP id ek2mr47287730vdb.11.1386091675668; Tue, 03 Dec 2013 09:27:55 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp226114vcz; Tue, 3 Dec 2013 09:27:55 -0800 (PST) X-Received: by 10.49.81.178 with SMTP id b18mr31428050qey.0.1386091675210; Tue, 03 Dec 2013 09:27:55 -0800 (PST) Received: from SMTP02.CITRIX.COM (smtp02.citrix.com. [66.165.176.63]) by mx.google.com with ESMTPS id k3si14412939qaz.111.2013.12.03.09.27.54 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 03 Dec 2013 09:27:55 -0800 (PST) Received-SPF: pass (google.com: domain of Ian.Campbell@citrix.com designates 66.165.176.63 as permitted sender) client-ip=66.165.176.63; X-IronPort-AV: E=Sophos;i="4.93,819,1378857600"; d="scan'208";a="77830694" Received: from accessns.citrite.net (HELO FTLPEX01CL03.citrite.net) ([10.9.154.239]) by FTLPIPO02.CITRIX.COM with ESMTP; 03 Dec 2013 17:27:53 +0000 Received: from [10.80.2.80] (10.80.2.80) by FTLPEX01CL03.citrite.net (10.13.107.80) with Microsoft SMTP Server id 14.2.342.4; Tue, 3 Dec 2013 12:27:53 -0500 Message-ID: <1386091671.13256.73.camel@kazak.uk.xensource.com> Subject: Re: [Xen-devel] [PATCH] xen: arm: Fixing ttbcr (TCR_EL1 for AArch64) size. From: Ian Campbell To: Pranavkumar Sawargaonkar CC: Julien Grall , Anup Patel , Patch Tracking , , , , Date: Tue, 3 Dec 2013 17:27:51 +0000 In-Reply-To: References: <1386072224-4478-1-git-send-email-pranavkumar@linaro.org> <1386078453.13256.35.camel@kazak.uk.xensource.com> <1386085234.13256.49.camel@kazak.uk.xensource.com> <529E0224.3000407@linaro.org> Organization: Citrix Systems, Inc. X-Mailer: Evolution 3.4.4-3 MIME-Version: 1.0 X-Originating-IP: [10.80.2.80] X-DLP: MIA2 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ian.campbell@citrix.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , On Tue, 2013-12-03 at 21:50 +0530, Pranavkumar Sawargaonkar wrote: > > Acked-by: Julien Grall > Thanks for spotting other changes. > Patch looks good for me. Thanks. May I translate that into an Acked-by? Actually my 64-bit userspace build test wasn't actually building (just installing, oops!) so I missed out updating ./tools/include/xen-foreign/reference.size and xenctx. v2 below. -------8<----------------- >From f49eae50daf4c6be11abbb43c2a74e3643798044 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Tue, 3 Dec 2013 15:13:36 +0000 Subject: [PATCH] xen: arm: TCR_EL1 is 64-bit on arm64 Storing it in a 32-bit variable in struct arch_vcpu caused breakage over context switch. There were also several other places which stored this as the 32-bit value. Update them all. The "struct vcpu_guest_context" case needs special consideration. This struct is in theory is exposed to guests, via the VCPUOP_initialise hypercall. However as discussed in http://lists.xen.org/archives/html/xen-devel/2013-10/msg00912.html this isn't really a guest visible interface since ARM uses PSCI for VCPU bringup (VCPUOP_initialise simply isn't available) The other users of this interface are the domctls, which are not a stable API. Therefore while fixing the ttbcr size also surround the struct in ifdefs to restrict the struct to the hypervisor and the tools only (omitting the extra complexity of renaming as I suggested in the referenced thread). NB TCR_EL1 on arm64 is known as TTBCR on arm32, hence the apparent naming inconsistencies. Spotted-by: Pranavkumar Sawargaonkar Signed-off-by: Ian Campbell Acked-by: Julien Grall Cc: Anup Patel Cc: patches@linaro.org Cc: patches@apm.com Acked-by: Pranavkumar Sawargaonkar --- v2: Update foreign header reference sizes, fix xenctx. --- tools/include/xen-foreign/reference.size | 2 +- tools/xentrace/xenctx.c | 2 +- xen/arch/arm/traps.c | 11 ++++++----- xen/include/asm-arm/domain.h | 2 +- xen/include/public/arch-arm.h | 6 ++++-- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/tools/include/xen-foreign/reference.size b/tools/include/xen-foreign/reference.size index b3347b4..60ee262 100644 --- a/tools/include/xen-foreign/reference.size +++ b/tools/include/xen-foreign/reference.size @@ -5,7 +5,7 @@ start_info | - - 1112 1168 trap_info | - - 8 16 cpu_user_regs | - - 68 200 vcpu_guest_core_regs | 304 304 - - -vcpu_guest_context | 336 336 2800 5168 +vcpu_guest_context | 344 344 2800 5168 arch_vcpu_info | 0 0 24 16 vcpu_time_info | 32 32 32 32 vcpu_info | 48 48 64 64 diff --git a/tools/xentrace/xenctx.c b/tools/xentrace/xenctx.c index ba502fd..7275a00 100644 --- a/tools/xentrace/xenctx.c +++ b/tools/xentrace/xenctx.c @@ -578,7 +578,7 @@ static void print_ctx(vcpu_guest_context_any_t *ctx_any) #endif printf("SCTLR: %08"PRIx32"\n", ctx->sctlr); - printf("TTBCR: %08"PRIx32"\n", ctx->ttbcr); + printf("TTBCR: %016"PRIx64"\n", ctx->ttbcr); printf("TTBR0: %016"PRIx64"\n", ctx->ttbr0); printf("TTBR1: %016"PRIx64"\n", ctx->ttbr1); } diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 8144b2b..458128e 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -330,7 +330,8 @@ static void inject_undef64_exception(struct cpu_user_regs *regs, int instr_len) struct reg_ctxt { /* Guest-side state */ - uint32_t sctlr_el1, tcr_el1; + uint32_t sctlr_el1; + register_t tcr_el1; uint64_t ttbr0_el1, ttbr1_el1; #ifdef CONFIG_ARM_32 uint32_t dfsr, ifsr; @@ -433,7 +434,7 @@ static void show_registers_32(struct cpu_user_regs *regs, if ( guest_mode ) { printk(" SCTLR: %08"PRIx32"\n", ctxt->sctlr_el1); - printk(" TCR: %08"PRIx32"\n", ctxt->tcr_el1); + printk(" TCR: %08"PRIregister"\n", ctxt->tcr_el1); printk(" TTBR0: %016"PRIx64"\n", ctxt->ttbr0_el1); printk(" TTBR1: %016"PRIx64"\n", ctxt->ttbr1_el1); printk(" IFAR: %08"PRIx32", IFSR: %08"PRIx32"\n" @@ -505,7 +506,7 @@ static void show_registers_64(struct cpu_user_regs *regs, printk(" FAR_EL1: %016"PRIx64"\n", ctxt->far); printk("\n"); printk(" SCTLR_EL1: %08"PRIx32"\n", ctxt->sctlr_el1); - printk(" TCR_EL1: %08"PRIx32"\n", ctxt->tcr_el1); + printk(" TCR_EL1: %08"PRIregister"\n", ctxt->tcr_el1); printk(" TTBR0_EL1: %016"PRIx64"\n", ctxt->ttbr0_el1); printk(" TTBR1_EL1: %016"PRIx64"\n", ctxt->ttbr1_el1); printk("\n"); @@ -1257,14 +1258,14 @@ static void do_sysreg(struct cpu_user_regs *regs, void dump_guest_s1_walk(struct domain *d, vaddr_t addr) { - uint32_t ttbcr = READ_SYSREG32(TCR_EL1); + register_t ttbcr = READ_SYSREG(TCR_EL1); uint64_t ttbr0 = READ_SYSREG64(TTBR0_EL1); paddr_t paddr; uint32_t offset; uint32_t *first = NULL, *second = NULL; printk("dom%d VA 0x%08"PRIvaddr"\n", d->domain_id, addr); - printk(" TTBCR: 0x%08"PRIx32"\n", ttbcr); + printk(" TTBCR: 0x%08"PRIregister"\n", ttbcr); printk(" TTBR0: 0x%016"PRIx64" = 0x%"PRIpaddr"\n", ttbr0, p2m_lookup(d, ttbr0 & PAGE_MASK)); diff --git a/xen/include/asm-arm/domain.h b/xen/include/asm-arm/domain.h index d5cae2e..8ebee3e 100644 --- a/xen/include/asm-arm/domain.h +++ b/xen/include/asm-arm/domain.h @@ -165,7 +165,7 @@ struct arch_vcpu /* MMU */ register_t vbar; - uint32_t ttbcr; + register_t ttbcr; uint64_t ttbr0, ttbr1; uint32_t dacr; /* 32-bit guests only */ diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h index cb41ddc..475cb4a 100644 --- a/xen/include/public/arch-arm.h +++ b/xen/include/public/arch-arm.h @@ -278,6 +278,7 @@ typedef uint64_t xen_pfn_t; typedef uint64_t xen_ulong_t; #define PRI_xen_ulong PRIx64 +#if defined(__XEN__) || defined(__XEN_TOOLS__) struct vcpu_guest_context { #define _VGCF_online 0 #define VGCF_online (1<<_VGCF_online) @@ -285,11 +286,12 @@ struct vcpu_guest_context { struct vcpu_guest_core_regs user_regs; /* Core CPU registers */ - uint32_t sctlr, ttbcr; - uint64_t ttbr0, ttbr1; + uint32_t sctlr; + uint64_t ttbcr, ttbr0, ttbr1; }; typedef struct vcpu_guest_context vcpu_guest_context_t; DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t); +#endif struct arch_vcpu_info { };