From patchwork Tue Dec 12 19:02:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 121646 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4508894qgn; Tue, 12 Dec 2017 11:04:53 -0800 (PST) X-Google-Smtp-Source: ACJfBosY452KRNvd/Mkl9eOiCb3lLufkLyUofLHZ1lkkXfD0uvcaG8/d5cWPw6m9MatTDzAivnhW X-Received: by 10.107.9.153 with SMTP id 25mr6407748ioj.214.1513105493464; Tue, 12 Dec 2017 11:04:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513105493; cv=none; d=google.com; s=arc-20160816; b=he+Dh2ZcQ0FgNx41dLyXNnb7Oy47H1+elRB2ri+8PndJ5fOn0M7iSzjT8t3EU0UnLm NhnYoPM20pQ69yyodc+ndHW2ahKVJfXUMfTyrCw32BfRWOs0DbaPElFH2A4Ddod9DinI Z5vG7r27q9WI9n2voZ+wCOzMYnECS+PCzndrpYx6OeizlxcufLQ03nOnhOsW6rfktguu 1YLLg11xJF21F/vwSrI7Gt4WJ6tKzBspfeI56zQI5tGswzdSspJ6Kx6KudxUuXaMMcyz Mfq52zmCnkwAN0DFQRWh++5OSjNGB+lSWllVWoH3oTz9LYg4vSeAF/NK3kHeG0sC8Syr uwHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:dkim-signature:arc-authentication-results; bh=CZE+oyomRKKvRSlGYC1+McHASPRxcTY2mwBzixb5DKc=; b=mccomAI6RufXRJogN4cvCQlLYSasAbPAstbFZ6GSdyceeDKuEM9zRUfkrX/VozKW1i w3HhnpX1121VtXCZufiATi9AUzoLKMBz4i1/lJ1Bix9ROXwkns9IIvQtBQD7HUdkjYg5 0dSpuFLsfCgt8qdDTieE2FcIlFSxgqf/mtokydl51WZv2PTN8USnDPEazdis3chkTr5K URAPzK9GYI3nENB6Og19N3CacLFnAo01uNqMSOC3HOA8WsAM7DCK3fae5jIeC4TsL+zr S5VXKwWbQYbsnWRt07fF41Lda5U1cGKopl+HbKJoV3kJ/i8g8z9vzgsL1XFu/6S0XEhn N94A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=S5M0Qjms; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id x96si189164ita.75.2017.12.12.11.04.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Dec 2017 11:04:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=S5M0Qjms; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eOppI-0002qE-Gb; Tue, 12 Dec 2017 19:02:48 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eOppH-0002oF-6d for xen-devel@lists.xen.org; Tue, 12 Dec 2017 19:02:47 +0000 X-Inumbo-ID: f636b397-df6e-11e7-b4a6-bc764e045a96 Received: from mail-wm0-x235.google.com (unknown [2a00:1450:400c:c09::235]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id f636b397-df6e-11e7-b4a6-bc764e045a96; Tue, 12 Dec 2017 20:02:13 +0100 (CET) Received: by mail-wm0-x235.google.com with SMTP id f9so736252wmh.0 for ; Tue, 12 Dec 2017 11:02:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=qPFzJq8aaVN4O0j6U4B5pbmSl19Ta7P3rtY7sc2bLOE=; b=S5M0QjmsdPfR/jHgW2Ab5SIjDGIy5fQWr4cHM3HmJzBxBnyfdQB6ZkX6U3cDKurrbS Dr8VB1dbA7nQfo2lG7wPZi4mN5TX42qJ3rLm9r7+gdWyX3RtKvqmCRqvki5jj0mWDIpO 9yYH4amD/1dPmdoJhBZQSRe+RGTTDw9k7gQHg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=qPFzJq8aaVN4O0j6U4B5pbmSl19Ta7P3rtY7sc2bLOE=; b=g1R+AJOYUaEV3FAjQpCBDfdJcmKobLuc9+wLUbBOmdRfXzjL/njotfc+5F+beDvAiz dTP4U5DNtz5uV3ld71tYSsW5vK9jSWQcYIwh0wAdlh7Aq+/Wxu7CfnvjwYdhrwRaxKte CbAhqXjTPJzEvbF/I91zt8s/+MBeSiY5fjuJ79koUyeK8AnccGPbGi2nmu7Ip4t9VyMF +qrjKuHS7MXh5wLeYVHjTJPmoDGcZDDqJ+I65UvxzwKlCqBaMKTZ8Q23axgzsZRyosGf xhlIfPlHEAOFT9nmARiPZrzGXyEI5tRyxAh273RIFR9MR8m3cZPeqCc6H+Dk5eTneHEU cecQ== X-Gm-Message-State: AKGB3mJowW1uFEA02VnO4KNQdCs37ftX+8565AXIcFUFR06cQWZseN/9 JOKew9ucpz4+BJZQFeyQbfXcKpbvAzI= X-Received: by 10.28.5.201 with SMTP id 192mr2513460wmf.142.1513105364086; Tue, 12 Dec 2017 11:02:44 -0800 (PST) Received: from e108454-lin.cambridge.arm.com ([2001:41d0:1:6c23::1]) by smtp.gmail.com with ESMTPSA id n14sm207508wmh.37.2017.12.12.11.02.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Dec 2017 11:02:43 -0800 (PST) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 12 Dec 2017 19:02:11 +0000 Message-Id: <20171212190212.5535-16-julien.grall@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171212190212.5535-1-julien.grall@linaro.org> References: <20171212190212.5535-1-julien.grall@linaro.org> Cc: sstabellini@kernel.org, Julien Grall , andre.przywara@linaro.org Subject: [Xen-devel] [v2 15/16] xen/arm: traps: Move the definition of mmio_info_t in try_handle_mmio X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" mmio_info_t is currently filled by do_trap_data_guest_abort but only important when emulation an MMIO region. A follow-up patch will merge stage-2 prefetch abort and stage-2 data abort in a single helper. To prepare that, mmio_info_t is now filled by try_handle_mmio. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini dabt; + const struct hsr_dabt dabt = hsr.dabt; + mmio_info_t info = { + .gpa = gpa, + .dabt = dabt + }; int rc; /* stage-1 page table should never live in an emulated MMIO region */ @@ -1955,7 +1960,7 @@ static bool try_handle_mmio(struct cpu_user_regs *regs, if ( check_workaround_766422() && (regs->cpsr & PSR_THUMB) && dabt.write ) { - rc = decode_instruction(regs, &info->dabt); + rc = decode_instruction(regs, &info.dabt); if ( rc ) { gprintk(XENLOG_DEBUG, "Unable to decode instruction\n"); @@ -1963,7 +1968,7 @@ static bool try_handle_mmio(struct cpu_user_regs *regs, } } - return !!handle_mmio(info); + return !!handle_mmio(&info); } /* @@ -2001,7 +2006,7 @@ static void do_trap_data_abort_guest(struct cpu_user_regs *regs, const struct hsr_dabt dabt = hsr.dabt; int rc; vaddr_t gva; - mmio_info_t info; + paddr_t gpa; uint8_t fsc = hsr.dabt.dfsc & ~FSC_LL_MASK; mfn_t mfn; @@ -2012,15 +2017,13 @@ static void do_trap_data_abort_guest(struct cpu_user_regs *regs, if ( dabt.eat ) return __do_trap_serror(regs, true); - info.dabt = dabt; - gva = get_hfar(true /* is_data */); if ( hpfar_is_valid(dabt.s1ptw, fsc) ) - info.gpa = get_faulting_ipa(gva); + gpa = get_faulting_ipa(gva); else { - rc = gva_to_ipa(gva, &info.gpa, GV2M_READ); + rc = gva_to_ipa(gva, &gpa, GV2M_READ); /* * We may not be able to translate because someone is * playing with the Stage-2 page table of the domain. @@ -2041,7 +2044,7 @@ static void do_trap_data_abort_guest(struct cpu_user_regs *regs, .kind = dabt.s1ptw ? npfec_kind_in_gpt : npfec_kind_with_gla }; - p2m_mem_access_check(info.gpa, gva, npfec); + p2m_mem_access_check(gpa, gva, npfec); /* * The only way to get here right now is because of mem_access, * thus reinjecting the exception to the guest is never required. @@ -2053,7 +2056,7 @@ static void do_trap_data_abort_guest(struct cpu_user_regs *regs, * Attempt first to emulate the MMIO as the data abort will * likely happen in an emulated region. */ - if ( try_handle_mmio(regs, &info) ) + if ( try_handle_mmio(regs, hsr, gpa) ) { advance_pc(regs, hsr); return; @@ -2064,11 +2067,11 @@ static void do_trap_data_abort_guest(struct cpu_user_regs *regs, * with the Stage-2 page table. Walk the Stage-2 PT to check * if the entry exists. If it's the case, return to the guest */ - mfn = gfn_to_mfn(current->domain, gaddr_to_gfn(info.gpa)); + mfn = gfn_to_mfn(current->domain, gaddr_to_gfn(gpa)); if ( !mfn_eq(mfn, INVALID_MFN) ) return; - if ( try_map_mmio(gaddr_to_gfn(info.gpa)) ) + if ( try_map_mmio(gaddr_to_gfn(gpa)) ) return; break; @@ -2078,7 +2081,7 @@ static void do_trap_data_abort_guest(struct cpu_user_regs *regs, } gdprintk(XENLOG_DEBUG, "HSR=0x%x pc=%#"PRIregister" gva=%#"PRIvaddr - " gpa=%#"PRIpaddr"\n", hsr.bits, regs->pc, gva, info.gpa); + " gpa=%#"PRIpaddr"\n", hsr.bits, regs->pc, gva, gpa); inject_dabt_exception(regs, gva, hsr.len); }