From patchwork Sun Oct 2 17:29:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 611753 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp720848pvb; Sun, 2 Oct 2022 10:38:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5oQAXcA3GJnXv18fZuPhtXfmuu/zVaAS4Uk+60aXeNokKjcfOUVHz6NxQ285SMx+TEBINZ X-Received: by 2002:a05:6214:27cf:b0:4ac:d6ad:379e with SMTP id ge15-20020a05621427cf00b004acd6ad379emr13763662qvb.121.1664732321158; Sun, 02 Oct 2022 10:38:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664732321; cv=none; d=google.com; s=arc-20160816; b=WWq2iiaGqorOn3BmG5bV7ogLexi6uIsH439OiorA79cAkrdvyoiTPNS9xD04Izn4Dh lw2sjkEAmAyAcDcrJB4lJziazL/JNRuD0pWaEelNmk3R+g71Z4TzEjVmsEZeqvkCOp+h lUJgYIo+SR3oxnWHPycBrkeFPRKtBZhcy3mgSVkJvPVdmkVTqGxb4f9lopb41Ugrn281 tVxrWskskuW2B5qu8/1Z2q7iw4E9ggkQ5TyTAGN3GoiKP84nBdcEjbLSyFez522fTt4k Zu7J2+gokQwLsfFvnH9g/F3ZfvLJDjF5dmeX4VCtidqdxQjMyEhm5Vos6S/qcLfX4Css T1lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LEJVqUhskGeG1MhK0CsszCgPcQtH98gJ6ePcJwlk5nI=; b=ZgMUNAJ6qzS+V9BZ1JuMy5pvonWuqZaQQTo7ZaHh1cy5y+sHT52l9N8VWqMsFDj8PN U/Png2wlez9IILZkqIOcmhojSFOEt481MsTChGKQ4NmYv9TCBmU7ahDk6ndi+jijPnIa p9LBzOeRDa0GS9VhDTqnbnHw3V7a1auEtBLBGmPdOl+ZDb5I5LZvGarmqIonzFqvpCv3 i3vypig40drULnmap7IE5yW9jTI3BkXxtHmc3SxpMIY4Y/kEGONwRX6EbEXQWbwEHFaK 7gE+lLzrZ/qcyVlz1R4CR5I42NX2f/nyOzKAGbijILxQVP3dmYLG4s2xNqVACRLDrc6o hO1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hKE4l0sJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j3-20020a05620a410300b006b8d79c90bdsi3765317qko.215.2022.10.02.10.38.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 02 Oct 2022 10:38:41 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hKE4l0sJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:33026 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1of2vI-0000T8-6d for patch@linaro.org; Sun, 02 Oct 2022 13:38:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44324) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1of2nQ-0005Sc-EL for qemu-devel@nongnu.org; Sun, 02 Oct 2022 13:30:43 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]:43643) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1of2nO-0006BH-Ta for qemu-devel@nongnu.org; Sun, 02 Oct 2022 13:30:32 -0400 Received: by mail-pl1-x62a.google.com with SMTP id z20so1371019plb.10 for ; Sun, 02 Oct 2022 10:30:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=LEJVqUhskGeG1MhK0CsszCgPcQtH98gJ6ePcJwlk5nI=; b=hKE4l0sJZz6bYHI/i6Knryi1tN7ogOk8v7KTDoT/fXQF6wJT+H8+rZW3lTABjkzZ/S nWDfzsYO/iPbpg4w68bvadMIdkmRvL6hmXpJL9v0X1GS+S9eh39Ykhsbk0uf7AjG8MgY e20wQ9dbfue194RXIaLlwgsUJPSABvjZTr5KkoQpmAFItyJ+7hSLEDXL9jcdVHLhUi7k s+vL0hqLsxE5LL+oTKy5p0L/hr5aqOm2ZscfMRNWpAewgpZkXl9TtQtHTTPaZMeW4D+N lqfnmQrZN3eilUxP2xxDjgVogRR+k+b6e9pM2HQAXy/7bNFchB3TxjTfNxbb3CEWK9kD q2iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=LEJVqUhskGeG1MhK0CsszCgPcQtH98gJ6ePcJwlk5nI=; b=EiuwJRXUEj3oJAjJMm9vQPKZ4dXWiFLgKoMQ0d1ytupnDH8jVkXZ0q4Q60/bF8FXtR hDtEz60N1JYfaTO9YMfK+KgSOgw10nazr6dOaQ5bvBB7PCFKs8KOfZRG8fhESKGeOG59 56M5GYO2sBXWx8dYLPY7Sd+u+8hxe5DZqyKCG1J1SNn1nevEWtT6/kwoViXMUbuLXuHO gqv68ORQ0zE3JcKes5iuNv9A/pj7yzehAM7/ajSR6g+LO9nAxbRKuDaxbSRWOHNxRMbi brixxt3KCB7ocW5wO9zbFwEpy2PJnV+Qni0zBCPX+/Gh5WO/XNHOWfnHocJU8btzknVm dvWQ== X-Gm-Message-State: ACrzQf2psC76SfgOeR3Vg2gWi10Q3YICRGVG1gwkgoUKfClcBmUgrEfi BoCH9lJN19BxY7rUMf3Pdj0AJNOT5ke5Bg== X-Received: by 2002:a17:902:db0a:b0:178:32b9:6f51 with SMTP id m10-20020a170902db0a00b0017832b96f51mr18270766plx.145.1664731829294; Sun, 02 Oct 2022 10:30:29 -0700 (PDT) Received: from stoup.. ([2605:ef80:8002:3cad:72cd:dd96:98f6:c3cf]) by smtp.gmail.com with ESMTPSA id 135-20020a62168d000000b0056025ccc3bbsm2749783pfw.146.2022.10.02.10.30.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Oct 2022 10:30:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com Subject: [PATCH v2 2/9] target/i386: Direct call get_hphys from mmu_translate Date: Sun, 2 Oct 2022 10:29:49 -0700 Message-Id: <20221002172956.265735-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221002172956.265735-1-richard.henderson@linaro.org> References: <20221002172956.265735-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Use a boolean to control the call to get_hphys instead of passing a null function pointer. Signed-off-by: Richard Henderson --- target/i386/tcg/sysemu/excp_helper.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/target/i386/tcg/sysemu/excp_helper.c b/target/i386/tcg/sysemu/excp_helper.c index eee59aa977..c9f6afba29 100644 --- a/target/i386/tcg/sysemu/excp_helper.c +++ b/target/i386/tcg/sysemu/excp_helper.c @@ -24,14 +24,10 @@ #define PG_ERROR_OK (-1) -typedef hwaddr (*MMUTranslateFunc)(CPUState *cs, hwaddr gphys, MMUAccessType access_type, - int *prot); - #define GET_HPHYS(cs, gpa, access_type, prot) \ - (get_hphys_func ? get_hphys_func(cs, gpa, access_type, prot) : gpa) + (use_stage2 ? get_hphys(cs, gpa, access_type, prot) : gpa) -static int mmu_translate(CPUState *cs, hwaddr addr, - MMUTranslateFunc get_hphys_func, +static int mmu_translate(CPUState *cs, hwaddr addr, bool use_stage2, uint64_t cr3, MMUAccessType access_type, int mmu_idx, int pg_mode, hwaddr *xlat, int *page_size, int *prot) @@ -329,7 +325,7 @@ hwaddr get_hphys(CPUState *cs, hwaddr gphys, MMUAccessType access_type, return gphys; } - exit_info_1 = mmu_translate(cs, gphys, NULL, env->nested_cr3, + exit_info_1 = mmu_translate(cs, gphys, false, env->nested_cr3, access_type, MMU_USER_IDX, env->nested_pg_mode, &hphys, &page_size, &next_prot); if (exit_info_1 == PG_ERROR_OK) { @@ -395,7 +391,7 @@ static int handle_mmu_fault(CPUState *cs, vaddr addr, int size, } } - error_code = mmu_translate(cs, addr, get_hphys, env->cr[3], access_type, + error_code = mmu_translate(cs, addr, true, env->cr[3], access_type, mmu_idx, pg_mode, &paddr, &page_size, &prot); }