From patchwork Wed Jun 28 15:52:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 697242 Delivered-To: patch@linaro.org Received: by 2002:adf:e885:0:0:0:0:0 with SMTP id d5csp4422193wrm; Wed, 28 Jun 2023 08:55:03 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5LWS01XuaRfeeiAC0clJgarWrLuWtQEY00MSVh7HGQXUYo40Pk7PczYJmVIl8N34+hd6Oo X-Received: by 2002:ac8:5fc4:0:b0:400:8f5b:d3e6 with SMTP id k4-20020ac85fc4000000b004008f5bd3e6mr16374982qta.6.1687967702762; Wed, 28 Jun 2023 08:55:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687967702; cv=none; d=google.com; s=arc-20160816; b=kh3dIdEU+6HCcmlXqTsYZ9hkBgdRmVjvmdnCpM10Uxxg4Zb3LnpyBSrD0/U4Vb+/t0 lDy8t5CB1HxLQ0KZ42vljyNMVeHNOr+lkYMsWDx6LKvTe8utDdUWvuA/JHDBBfgx739w bmxunUbeE7Vl9rxGxmsub5xtfM0psIk9mZKaqzp2uhNmioizuKmvQd30yw8pPVLSDcWa BPygMznKL2FQkE4vZdDbD0EGTqjkPpWZz+jsL+PZvipnR/Ptd9U9QsXB3QnGc1OJVmWU aLShjbyqEg6yARiI+v6kS+VIdhOcgyr3pFGr7zfwaDMqeUjuPUPnsiOK8OcJuwQPGtS1 Z4lg== 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=rs6kGmyhNHvaf593KeKxsHA2xbPI2IKFg9AnCMCq99I=; fh=qtn8prgQtzf5IzCNvLChUZDElvNECP6ej9YfjQeBz3I=; b=IX0d4sy3Tkaxzaigh8tBa3b/tWwA5BMlYubha+pQnxQLGI3wo2iojfAuivAgHjWjGS InupUbTSvuUY5gdWWF1S4bBVe8D6HMikuxcAkXJcLvaZSy7Irmd7Ir73wgci7r0LtdVc uz9s4gNS9YqA14GTPUHWPOE2i/pQlNXZg1UAr3LlQbMHnIQ/77ST3eLb4ax+FRg6wJCw qqk0lDCMcSQoqug05S88Keo/p6cK7+S9OdH+JQc1vEpNPVjLDHVz5+Q6i5i9mVvqo8T7 pNmNvAJe3KKbzSxsKqbgRsPC1mMG6ao77oKaAR2zoA6jqv4G6rJnU1VpKkftTeO6T5eD giGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dimjz60j; 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 n6-20020a05622a040600b003f9b8646458si4731633qtx.804.2023.06.28.08.55.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Jun 2023 08:55:02 -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=dimjz60j; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qEXV5-0007iM-1W; Wed, 28 Jun 2023 11:54:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qEXV3-0007WW-F9 for qemu-devel@nongnu.org; Wed, 28 Jun 2023 11:54:33 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qEXV1-0000Ax-AG for qemu-devel@nongnu.org; Wed, 28 Jun 2023 11:54:33 -0400 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-3fba66f3e1dso460665e9.3 for ; Wed, 28 Jun 2023 08:54:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1687967669; x=1690559669; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rs6kGmyhNHvaf593KeKxsHA2xbPI2IKFg9AnCMCq99I=; b=dimjz60j70lpM/LzB1qxoVUyTLvJN4lWJzLNUzDz7sv+M/VLzGIXxHpjf0t0YpbkpB sEgEiM1bCv1XdaDosH/LLRCRylHFvj1zHezVqqPD9fyN/NKgs3KGu3viH01nxvsbfoaB yDzP37t39FFfeYRqAyWfpkjzh0Asn5yBf+LKeES4qYqwmADnfSK2+bh8rVti3oPezZrA GvveUU/1xOBANWSTI2OIAeYYryl36fmdSTKT7Sdx+XugYmDpWidxPXvsRIGzZOGe+1o1 yqjyYwIfSDX9mnnt+1+wMzRZX537YRDyFatSgqnQRjluxH5fkpq1sJ2xCFx3eU1OTnZ/ fJow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687967669; x=1690559669; 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=rs6kGmyhNHvaf593KeKxsHA2xbPI2IKFg9AnCMCq99I=; b=EN1mxujXNd/rCBLh2LqVbxNE0qUb7TelcsPz3Jh3r6mP17a5maSOfpEGhtOoTtJN6k cQvOiTRjgncf2ko4k8gdyL3pqelst69YdIlvzZkxrElVSEW/fqsnYWtrNkJgeZBVf665 +3GG3RtUUDu0WaZdOWoWnC1eBYO+6eXEGUr6/+uf+6DnnpzCsDAynBAADjrIEO14UTSe x21m8nPuezgYycx6VcZ09WfD0xXNQE/eRi0NPC7iexL20UyAHgpDbGHMMRwxT378k8mb g++ER72yepXL5UF09Pwg8B0Xk86w3maik7kEUzVPUPThk1KdGmeITk1YVSiicmoQ938u nLtg== X-Gm-Message-State: ABy/qLZ5D2v6BN5zrqyu5lhiVGTQNiDrT3wslE+Cn69w6Uxu7RGGevAb 7T1y8YkJXwiwQOaTbhh1rHkXmdMVIE4O0RKXWqs= X-Received: by 2002:a5d:698b:0:b0:314:11d7:c919 with SMTP id g11-20020a5d698b000000b0031411d7c919mr614940wru.49.1687967669638; Wed, 28 Jun 2023 08:54:29 -0700 (PDT) Received: from m1x-phil.lan ([176.187.207.229]) by smtp.gmail.com with ESMTPSA id i18-20020a5d5232000000b003047ae72b14sm13716140wra.82.2023.06.28.08.54.28 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 28 Jun 2023 08:54:29 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PULL 13/30] accel: Inline NVMM get_qemu_vcpu() Date: Wed, 28 Jun 2023 17:52:56 +0200 Message-Id: <20230628155313.71594-14-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230628155313.71594-1-philmd@linaro.org> References: <20230628155313.71594-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=philmd@linaro.org; helo=mail-wm1-x334.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, T_SCC_BODY_TEXT_LINE=-0.01 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-bounces+patch=linaro.org@nongnu.org No need for this helper to access the CPUState::accel field. Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20230624174121.11508-12-philmd@linaro.org> --- target/i386/nvmm/nvmm-all.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/target/i386/nvmm/nvmm-all.c b/target/i386/nvmm/nvmm-all.c index e5ee4af084..72a3a9e3ae 100644 --- a/target/i386/nvmm/nvmm-all.c +++ b/target/i386/nvmm/nvmm-all.c @@ -49,12 +49,6 @@ struct qemu_machine { static bool nvmm_allowed; static struct qemu_machine qemu_mach; -static AccelCPUState * -get_qemu_vcpu(CPUState *cpu) -{ - return cpu->accel; -} - static struct nvmm_machine * get_nvmm_mach(void) { @@ -86,7 +80,7 @@ nvmm_set_registers(CPUState *cpu) { CPUX86State *env = cpu->env_ptr; struct nvmm_machine *mach = get_nvmm_mach(); - AccelCPUState *qcpu = get_qemu_vcpu(cpu); + AccelCPUState *qcpu = cpu->accel; struct nvmm_vcpu *vcpu = &qcpu->vcpu; struct nvmm_x64_state *state = vcpu->state; uint64_t bitmap; @@ -223,7 +217,7 @@ nvmm_get_registers(CPUState *cpu) { CPUX86State *env = cpu->env_ptr; struct nvmm_machine *mach = get_nvmm_mach(); - AccelCPUState *qcpu = get_qemu_vcpu(cpu); + AccelCPUState *qcpu = cpu->accel; struct nvmm_vcpu *vcpu = &qcpu->vcpu; X86CPU *x86_cpu = X86_CPU(cpu); struct nvmm_x64_state *state = vcpu->state; @@ -347,7 +341,7 @@ static bool nvmm_can_take_int(CPUState *cpu) { CPUX86State *env = cpu->env_ptr; - AccelCPUState *qcpu = get_qemu_vcpu(cpu); + AccelCPUState *qcpu = cpu->accel; struct nvmm_vcpu *vcpu = &qcpu->vcpu; struct nvmm_machine *mach = get_nvmm_mach(); @@ -372,7 +366,7 @@ nvmm_can_take_int(CPUState *cpu) static bool nvmm_can_take_nmi(CPUState *cpu) { - AccelCPUState *qcpu = get_qemu_vcpu(cpu); + AccelCPUState *qcpu = cpu->accel; /* * Contrary to INTs, NMIs always schedule an exit when they are @@ -395,7 +389,7 @@ nvmm_vcpu_pre_run(CPUState *cpu) { CPUX86State *env = cpu->env_ptr; struct nvmm_machine *mach = get_nvmm_mach(); - AccelCPUState *qcpu = get_qemu_vcpu(cpu); + AccelCPUState *qcpu = cpu->accel; struct nvmm_vcpu *vcpu = &qcpu->vcpu; X86CPU *x86_cpu = X86_CPU(cpu); struct nvmm_x64_state *state = vcpu->state; @@ -478,7 +472,7 @@ nvmm_vcpu_pre_run(CPUState *cpu) static void nvmm_vcpu_post_run(CPUState *cpu, struct nvmm_vcpu_exit *exit) { - AccelCPUState *qcpu = get_qemu_vcpu(cpu); + AccelCPUState *qcpu = cpu->accel; CPUX86State *env = cpu->env_ptr; X86CPU *x86_cpu = X86_CPU(cpu); uint64_t tpr; @@ -565,7 +559,7 @@ static int nvmm_handle_rdmsr(struct nvmm_machine *mach, CPUState *cpu, struct nvmm_vcpu_exit *exit) { - AccelCPUState *qcpu = get_qemu_vcpu(cpu); + AccelCPUState *qcpu = cpu->accel; struct nvmm_vcpu *vcpu = &qcpu->vcpu; X86CPU *x86_cpu = X86_CPU(cpu); struct nvmm_x64_state *state = vcpu->state; @@ -610,7 +604,7 @@ static int nvmm_handle_wrmsr(struct nvmm_machine *mach, CPUState *cpu, struct nvmm_vcpu_exit *exit) { - AccelCPUState *qcpu = get_qemu_vcpu(cpu); + AccelCPUState *qcpu = cpu->accel; struct nvmm_vcpu *vcpu = &qcpu->vcpu; X86CPU *x86_cpu = X86_CPU(cpu); struct nvmm_x64_state *state = vcpu->state; @@ -686,7 +680,7 @@ nvmm_vcpu_loop(CPUState *cpu) { CPUX86State *env = cpu->env_ptr; struct nvmm_machine *mach = get_nvmm_mach(); - AccelCPUState *qcpu = get_qemu_vcpu(cpu); + AccelCPUState *qcpu = cpu->accel; struct nvmm_vcpu *vcpu = &qcpu->vcpu; X86CPU *x86_cpu = X86_CPU(cpu); struct nvmm_vcpu_exit *exit = vcpu->exit; @@ -892,7 +886,7 @@ static void nvmm_ipi_signal(int sigcpu) { if (current_cpu) { - AccelCPUState *qcpu = get_qemu_vcpu(current_cpu); + AccelCPUState *qcpu = current_cpu->accel; #if NVMM_USER_VERSION >= 2 struct nvmm_vcpu *vcpu = &qcpu->vcpu; nvmm_vcpu_stop(vcpu); @@ -1023,7 +1017,7 @@ void nvmm_destroy_vcpu(CPUState *cpu) { struct nvmm_machine *mach = get_nvmm_mach(); - AccelCPUState *qcpu = get_qemu_vcpu(cpu); + AccelCPUState *qcpu = cpu->accel; nvmm_vcpu_destroy(mach, &qcpu->vcpu); g_free(cpu->accel);