From patchwork Sat Jun 24 17:41:19 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: 695723 Delivered-To: patch@linaro.org Received: by 2002:adf:e885:0:0:0:0:0 with SMTP id d5csp2502958wrm; Sat, 24 Jun 2023 10:44:17 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4xzq2DQJQX3HxpyBteIruXhOywGlrDIQJxY1L25q35wuMgKfLtKX+Py2kLu3kQ7ubreE9D X-Received: by 2002:a05:622a:1487:b0:3ff:2ace:cdfd with SMTP id t7-20020a05622a148700b003ff2acecdfdmr15820549qtx.33.1687628657685; Sat, 24 Jun 2023 10:44:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687628657; cv=none; d=google.com; s=arc-20160816; b=0OWEjOqMW1VZs0CzG8nt93s+pwIJGcMsVnlxclHmxoFQH5An7rIW+UW5KmZQGLbESG RlMzMaDDIZYM+015NcxNsZVO0HvQjHGFZxQIDqmq9NAiNZrIx6aLP1++JtWghTzFxdKp Gy8nK5gFQGyB7rUnr8FK268fyO51fXc5Doy90yQZzX9Xw+3qd0MFcCMoTExTbUwlBpsC TGDuFuvMAclqbfhM+hBCMuwAojbjS20GuH45KQ+gFtpPPMbHImvOy9Rvb6nUUh8ki8t6 CCXqZCiPuqktlyaREcmGQW10og4ZQsG/hosGvRCeFoLO6aozhxOsDX4dwBDtrrS4b1Xz f8Vw== 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=AAPkMuMtNtRM9NXu99LXesVy8JoKNyay4INBIgU8fUM=; fh=dxlO8U8n9FJbkfu3NZ9xTJMkF/Fn5IQj359CkmYw0tg=; b=RS5bXoBIEHcIt+3iixIkw+z2rN4EjPkJDBPL9Ul3yPFZOxMeV+MGVLYwXr/apNWJ95 QEfJ22zcLU5nqieRaFRIoCnzYjUbw33hc/Yz5i4G+vWUfkP7VN2+KI090ckiMmNjaMOi 47XbwWP3+qL1ukXlWTa+hc7qpWF4FG/rGWuRgPErFoAfsUVhWMuIips7I0GGbehYvSEQ BnMdRYXHrio1TP5CGT8coR6pSzevIAJ+KYQeSdlHroaOs6IV2xELU3CO3LuUCXRI2xwc 5xOFo/7Bq5ZNjIO8jDW/NrOyJiW00qOx/F37Afmgdakn2FDXa/9cV9fm+gZ/km2A638B CGtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pDVczrLf; 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 e17-20020ac85991000000b003f68822e6c9si603900qte.77.2023.06.24.10.44.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 24 Jun 2023 10:44:17 -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=pDVczrLf; 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 1qD7I6-0000kM-Pq; Sat, 24 Jun 2023 13:43:18 -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 1qD7I1-0000Wx-7e for qemu-devel@nongnu.org; Sat, 24 Jun 2023 13:43:14 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qD7Hz-0007iX-IG for qemu-devel@nongnu.org; Sat, 24 Jun 2023 13:43:12 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-3f918922954so17425355e9.2 for ; Sat, 24 Jun 2023 10:43:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1687628589; x=1690220589; 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=AAPkMuMtNtRM9NXu99LXesVy8JoKNyay4INBIgU8fUM=; b=pDVczrLfie0P29Z7uCw5tOy4PEx87NBQoCGG3m0psbZUusSwEfLQ61OZL6TJ2kB1dJ tATN6G8yFgnC5O7/RtL7/IHp8luOuI9a0CAQzgEMx9UDPTQXlvR8sbrOYZG8bJrmUNQg /3FBzLpY41RnRaYP2NB0XTbSnaGO4aPWfsRV67qdMMOJR8x1sXQNb8tfR8/K7nF4Lssa 0KusLp2BM/Iws8Bzl7b9wq8cOsydsbBlEYgdjHb92A4e1Ui8CCXvSdCXeW32PC8Pi/zU qYoeGCSAHTqFSWULi9I7GFgtd8QD3Ykjh8zHuYSguFeSZJas3CSglD3lc6I5XkKu7nti YLBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687628589; x=1690220589; 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=AAPkMuMtNtRM9NXu99LXesVy8JoKNyay4INBIgU8fUM=; b=V947zw48F/gQDexRNV1HDEccef/P0T707hzaomnx6NGqJRded/FzanmDTIBR5yS+bm vTnKAMeUhkCzEulorrKCbh2pAT+HwFuHTOBVt8PHgTazvU8OLtONHPNROzp/jr5VyWdU klaMsEKnTs+l78w0pRGHg1/6yzS0KWJ4xDmybARPtJUTql2Hyk73Xt6TJ3GcZjVQNfSp U802yhhYZvMmO3XnMIa2x58K5rCOBFWoUIUObr2O3+e/7Sc7B1LwLsd54amVaX927t1g lkqptBPzGp3gf7Vb49VRShlcLWSHWmKgzow2/5mQMuPD2iTjhN5jwNxdxw9Y8nG/t01h 5oCg== X-Gm-Message-State: AC+VfDxKw5/Pm0BOdM6NC/Eg68ZaiOXifa9FCnFZDXVuZEEWSX5oSGju 19fQG4JIhFs+KcHoP20mN8+fxCwiuhCFeQxXGxM= X-Received: by 2002:a05:600c:2158:b0:3f9:aaa:37e7 with SMTP id v24-20020a05600c215800b003f90aaa37e7mr13332459wml.0.1687628589383; Sat, 24 Jun 2023 10:43:09 -0700 (PDT) Received: from m1x-phil.lan ([176.187.217.150]) by smtp.gmail.com with ESMTPSA id k21-20020a05600c0b5500b003fa88f4c0f5sm339874wmr.21.2023.06.24.10.43.06 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 24 Jun 2023 10:43:09 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: kvm@vger.kernel.org, Marcel Apfelbaum , Peter Maydell , Roman Bolshakov , qemu-arm@nongnu.org, Richard Henderson , Alexander Graf , xen-devel@lists.xenproject.org, Sunil Muthuswamy , Anthony Perard , Stefano Stabellini , Yanan Wang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Paul Durrant , Reinoud Zandijk , Eduardo Habkost , Cameron Esfahani , Paolo Bonzini Subject: [PATCH v3 14/16] accel: Inline WHPX get_whpx_vcpu() Date: Sat, 24 Jun 2023 19:41:19 +0200 Message-Id: <20230624174121.11508-15-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230624174121.11508-1-philmd@linaro.org> References: <20230624174121.11508-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=philmd@linaro.org; helo=mail-wm1-x32c.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=unavailable 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é --- target/i386/whpx/whpx-all.c | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index 4ddd2d076a..0903327ac5 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -256,15 +256,6 @@ static bool whpx_has_xsave(void) return whpx_xsave_cap.XsaveSupport; } -/* - * VP support - */ - -static AccelCPUState *get_whpx_vcpu(CPUState *cpu) -{ - return (AccelCPUState *)cpu->accel; -} - static WHV_X64_SEGMENT_REGISTER whpx_seg_q2h(const SegmentCache *qs, int v86, int r86) { @@ -390,7 +381,7 @@ static uint64_t whpx_cr8_to_apic_tpr(uint64_t cr8) static void whpx_set_registers(CPUState *cpu, int level) { struct whpx_state *whpx = &whpx_global; - AccelCPUState *vcpu = get_whpx_vcpu(cpu); + AccelCPUState *vcpu = cpu->accel; CPUX86State *env = cpu->env_ptr; X86CPU *x86_cpu = X86_CPU(cpu); struct whpx_register_set vcxt; @@ -609,7 +600,7 @@ static void whpx_get_xcrs(CPUState *cpu) static void whpx_get_registers(CPUState *cpu) { struct whpx_state *whpx = &whpx_global; - AccelCPUState *vcpu = get_whpx_vcpu(cpu); + AccelCPUState *vcpu = cpu->accel; CPUX86State *env = cpu->env_ptr; X86CPU *x86_cpu = X86_CPU(cpu); struct whpx_register_set vcxt; @@ -892,7 +883,7 @@ static const WHV_EMULATOR_CALLBACKS whpx_emu_callbacks = { static int whpx_handle_mmio(CPUState *cpu, WHV_MEMORY_ACCESS_CONTEXT *ctx) { HRESULT hr; - AccelCPUState *vcpu = get_whpx_vcpu(cpu); + AccelCPUState *vcpu = cpu->accel; WHV_EMULATOR_STATUS emu_status; hr = whp_dispatch.WHvEmulatorTryMmioEmulation( @@ -917,7 +908,7 @@ static int whpx_handle_portio(CPUState *cpu, WHV_X64_IO_PORT_ACCESS_CONTEXT *ctx) { HRESULT hr; - AccelCPUState *vcpu = get_whpx_vcpu(cpu); + AccelCPUState *vcpu = cpu->accel; WHV_EMULATOR_STATUS emu_status; hr = whp_dispatch.WHvEmulatorTryIoEmulation( @@ -1417,7 +1408,7 @@ static vaddr whpx_vcpu_get_pc(CPUState *cpu, bool exit_context_valid) * of QEMU, nor this port by calling WHvSetVirtualProcessorRegisters(). * This is the most common case. */ - AccelCPUState *vcpu = get_whpx_vcpu(cpu); + AccelCPUState *vcpu = cpu->accel; return vcpu->exit_ctx.VpContext.Rip; } else { /* @@ -1468,7 +1459,7 @@ static void whpx_vcpu_pre_run(CPUState *cpu) { HRESULT hr; struct whpx_state *whpx = &whpx_global; - AccelCPUState *vcpu = get_whpx_vcpu(cpu); + AccelCPUState *vcpu = cpu->accel; CPUX86State *env = cpu->env_ptr; X86CPU *x86_cpu = X86_CPU(cpu); int irq; @@ -1590,7 +1581,7 @@ static void whpx_vcpu_pre_run(CPUState *cpu) static void whpx_vcpu_post_run(CPUState *cpu) { - AccelCPUState *vcpu = get_whpx_vcpu(cpu); + AccelCPUState *vcpu = cpu->accel; CPUX86State *env = cpu->env_ptr; X86CPU *x86_cpu = X86_CPU(cpu); @@ -1617,7 +1608,7 @@ static void whpx_vcpu_process_async_events(CPUState *cpu) { CPUX86State *env = cpu->env_ptr; X86CPU *x86_cpu = X86_CPU(cpu); - AccelCPUState *vcpu = get_whpx_vcpu(cpu); + AccelCPUState *vcpu = cpu->accel; if ((cpu->interrupt_request & CPU_INTERRUPT_INIT) && !(env->hflags & HF_SMM_MASK)) { @@ -1656,7 +1647,7 @@ static int whpx_vcpu_run(CPUState *cpu) { HRESULT hr; struct whpx_state *whpx = &whpx_global; - AccelCPUState *vcpu = get_whpx_vcpu(cpu); + AccelCPUState *vcpu = cpu->accel; struct whpx_breakpoint *stepped_over_bp = NULL; WhpxStepMode exclusive_step_mode = WHPX_STEP_NONE; int ret; @@ -2290,7 +2281,7 @@ int whpx_vcpu_exec(CPUState *cpu) void whpx_destroy_vcpu(CPUState *cpu) { struct whpx_state *whpx = &whpx_global; - AccelCPUState *vcpu = get_whpx_vcpu(cpu); + AccelCPUState *vcpu = cpu->accel; whp_dispatch.WHvDeleteVirtualProcessor(whpx->partition, cpu->cpu_index); whp_dispatch.WHvEmulatorDestroyEmulator(vcpu->emulator);