From patchwork Tue Oct 18 13:29:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 616056 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp2638055pvb; Tue, 18 Oct 2022 06:42:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM76oI4YuqP5vu2VeTDPKpQGOL3/mWbkDMqkonch8/9z/sVg4uGx7tJDuLszRDqRz8EJjVyV X-Received: by 2002:a37:af84:0:b0:6ec:543e:cb24 with SMTP id y126-20020a37af84000000b006ec543ecb24mr1887124qke.562.1666100575996; Tue, 18 Oct 2022 06:42:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666100575; cv=none; d=google.com; s=arc-20160816; b=0cb5fxXJ3eahAkuMhXvjfLoQoxiZDdXA+tAqpLjz7/MzcuP0UJQP4wWwp8auU7H8Vo mxTUxgVz7eDfdHusyLI6/+METWawOjQQCykiAXJTdzLTwmhLwRkotveox2neVzuvEHbI agkVRcLkpuoU0CAmAuogbSYy5ZWscOWZ4JDlYsQ/z0SF/XFWRJwSUy7M46pCi8kbxFGG eUF8mnaKJWUyHH9h/UBv3lYhMyOYgoNQ4YwQiPcnMGj8QumkcFsQyte/RNM4O8pjeEHI cdPqEGO7bBqHdk3UEcqq5k7m2mxRNiuDwdhi9y8VipqfHZbFxns0VgN1GYbaIXHgmngk I8nQ== 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=osh32bXliqc9+xMnWun8jK/3xeIfkSUICao8CeLnwxs=; b=s9Hzn3148Qbw3yj7IoC1FGReBBYhX/MR8XJcjtvUKV9LehIY+NheDLAtJyXCVTaCda aeZE3W5xjg4fwdI/BNWDSiRux4WKZor0jXxB29+MLiMOFWoleT3JTrgu/KgPIfQyB75w 5ivXFN0fM2uZv6BONP01lvtC+353qrYfqtfYGzk9n1PI+pB4Tr5+4N5N0KvKyHS9aqpi /nCdY5tZNV1B7JGK5gLOIISlu75nNbLrPXDumZxZctIGnDxa0qwi7yf2CZY8gv+FTfGw WRXQDFzuGymn6Ih1vkH/ubfAIG3C4/RBRxoOpuqJAlxjC/ku0hajhR3La/eu5SgAiDIi FIew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="FHp1e/FW"; 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=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bk21-20020a05620a1a1500b006ee7e223bb0si7189674qkb.298.2022.10.18.06.42.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 18 Oct 2022 06:42:55 -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=@redhat.com header.s=mimecast20190719 header.b="FHp1e/FW"; 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=redhat.com Received: from localhost ([::1]:43600 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1okmrp-0002Ut-I8 for patch@linaro.org; Tue, 18 Oct 2022 09:42:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58666) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okmgw-0002MR-OW for qemu-devel@nongnu.org; Tue, 18 Oct 2022 09:31:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:48793) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okmgn-00051c-6M for qemu-devel@nongnu.org; Tue, 18 Oct 2022 09:31:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666099884; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=osh32bXliqc9+xMnWun8jK/3xeIfkSUICao8CeLnwxs=; b=FHp1e/FWgd3FcguqxAOS4svEpoAdMWgEGXkJ6P0Vvr1ZRk1u2O3dH1aWUYsvefQ4VgGQOj wP/LxUL3FkL/HUUcnEtLEvv737Lm2isvSfgQDcwIp+x60Vrh/7q/2NwY5rHWuF2JivbXSe Y762jlbF7ZBBooS3PCPUdDbQyrBKPig= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-490-SgFASPUdNuyk9hXbI676CQ-1; Tue, 18 Oct 2022 09:31:22 -0400 X-MC-Unique: SgFASPUdNuyk9hXbI676CQ-1 Received: by mail-ed1-f72.google.com with SMTP id z7-20020a05640235c700b0045d3841ccf2so8252724edc.9 for ; Tue, 18 Oct 2022 06:31:22 -0700 (PDT) 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:message-id:reply-to; bh=osh32bXliqc9+xMnWun8jK/3xeIfkSUICao8CeLnwxs=; b=lA3snfSlbxstdhIjTXxedif4T+aDNgCtG1j8/FBBGm7jN2id3gxCul5XxsPu/1uVsK GXhqbkZ55+fdDSN2wqHooaU0Zvu4KnOKTqI8SiJtxfqAXX6Ayy8HaeQWNco6j52wxjQW 6Ja1d0eLLrBj8YfcCEfsM07xt5ub5c/Ydo+e2nALzLYJfGDDzhB3at8q4cFX+7c+8brL DHugEeaWEJSUiasyNEvCVdkHRrHSe9b/fZAvizI254Trv6W+G2PyJT2FNouktUFWdPxt yh5WIQGTcGubwBl5neuKghKJnlmw1n8y4DeOcdZSaS0Y4sX47TtbzVt/X/kPDC3OnO8G wwww== X-Gm-Message-State: ACrzQf3Z6gH6fE8lgrjTuQkYe2YKy8IJI8B/yvKMgNQeihv9jps/3Gat IuGRJj2ar0It6lpunBHVmVJNbUCneRj8YeNZKTGJsX93Bz/cCko2Te5jTkgf2xCHYc7a/uvfc6N dMcGI1qNGggTx1m7qy3PldOXlqBM6nLxcucMHMffT4YY8oAKSZaG3DnmYftY5AWXZW9Y= X-Received: by 2002:a05:6402:3592:b0:45c:fb8a:c57d with SMTP id y18-20020a056402359200b0045cfb8ac57dmr2661382edc.290.1666099880987; Tue, 18 Oct 2022 06:31:20 -0700 (PDT) X-Received: by 2002:a05:6402:3592:b0:45c:fb8a:c57d with SMTP id y18-20020a056402359200b0045cfb8ac57dmr2661355edc.290.1666099880662; Tue, 18 Oct 2022 06:31:20 -0700 (PDT) Received: from avogadro.local ([2001:b07:6468:f312:2f4b:62da:3159:e077]) by smtp.gmail.com with ESMTPSA id c7-20020aa7d607000000b0045d74aa401fsm4920636edr.60.2022.10.18.06.31.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Oct 2022 06:31:20 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Richard Henderson Subject: [PULL 10/53] target/i386: Direct call get_hphys from mmu_translate Date: Tue, 18 Oct 2022 15:29:59 +0200 Message-Id: <20221018133042.856368-11-pbonzini@redhat.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221018133042.856368-1-pbonzini@redhat.com> References: <20221018133042.856368-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.256, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, 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" From: Richard Henderson Use a boolean to control the call to get_hphys instead of passing a null function pointer. Signed-off-by: Richard Henderson Message-Id: <20221002172956.265735-3-richard.henderson@linaro.org> Signed-off-by: Paolo Bonzini --- 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); }