From patchwork Fri Sep 13 15:13:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 828195 Delivered-To: patch@linaro.org Received: by 2002:adf:a2d0:0:b0:367:895a:4699 with SMTP id t16csp302006wra; Fri, 13 Sep 2024 08:20:50 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVRQshqsIomI0OsOEaPRxx4mPC5MmOD12hE291/LDYUbFY+F9m8rv9LFdavMotnwtxBT2arEw==@linaro.org X-Google-Smtp-Source: AGHT+IH1tzh2dy0KSixnPSpbYDBFhWisnLOxU8tWErWl+WVYkNi2TfanLvLW1GUUumteuGvEXg/q X-Received: by 2002:a05:6359:5fa3:b0:1b5:a032:9994 with SMTP id e5c5f4694b2df-1baf955a15amr359024655d.0.1726240850291; Fri, 13 Sep 2024 08:20:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726240850; cv=none; d=google.com; s=arc-20240605; b=OL+d6D8tFlq8szMztNdPCcieuOcKUL3oajMEXQOh6agVe5uIAwtogohdQXRRnwt0Ri Ck7v/TUiBwbENqLUyh4QcnLZWflRT01j9Nwte7ncIqpGNPnLd8X1+ARfxZO0JJQ7aogk oSf0za13oFq76hge2gm6gYa98qQhPo1xaArBnVxMVzwB5X3dI3OlpcMu+u11jDn5DvcC s+BYPbi20+uKEE0VYNAIKXFz+y8w4td/nUXEiaWE7GuHOWVOXjIziz+FeF1PcmSJLcCn 70MK6rT5os9s+PmDRJDN2hYK12U5+e3TlBKjIq69WMXnopOJ+Aq+J+iBpVI+xBgYQMpM FaMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:to:from :dkim-signature; bh=wrqlu0MBnX/IwubC7JB6PnaVoLkJuNGIJqIpkcG99Z0=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=AToWIf2rugxGOK8vrioGCvYcrxFeHbaWbI04DqVhcohal3XsH1xED4c0qt0XCC5+FZ g8Dfb/fWzjRrfUNfirAnr598zSx1F5qfV/6ju2TBHTAD9/lNaBxmO32HU5jVZxSeN07C qqYjaypdrH5K63tzzWDT9aiyytjj+ZawifNWrEoH/M6NjidLcWpyrADzjIdUHsTfl/Wo vtbfOnYihUgdPU8H87BylKEnwNsm8H556Bkakw8bczqP3tz0wL4303xFPQCghTK9RfqC p9eBDlLofUNOhSTfsPJilHUnBBBy3q5+tiACsaFXBZr0QpeWTDs3RSneUo+5p/YDMCzg QYGA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bCjPegGD; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 71dfb90a1353d-502f9b471ddsi2485476e0c.241.2024.09.13.08.20.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 13 Sep 2024 08:20:50 -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=bCjPegGD; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sp81A-000640-0k; Fri, 13 Sep 2024 11:15:28 -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 1sp809-00025c-1S for qemu-devel@nongnu.org; Fri, 13 Sep 2024 11:14:25 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sp806-0007n7-SS for qemu-devel@nongnu.org; Fri, 13 Sep 2024 11:14:24 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-42cae102702so9679715e9.0 for ; Fri, 13 Sep 2024 08:14:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726240460; x=1726845260; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=wrqlu0MBnX/IwubC7JB6PnaVoLkJuNGIJqIpkcG99Z0=; b=bCjPegGDQRwUKtiLErAZs/JZfUgrz5u1wRzQKqyW2atmPICu4uX6Jb8zkC20RIPy7P uFG5rxjEGryHyXI5tuYhbiyN2Odm7kA34jEQy1OVSDTEoieKMTHJG1OHErTXCCiRUI39 aBoWZwntOFx4lnmJ9NdaAUplHnHTVOrV/Mb5qSAvM66YdUVV/aBgJUMB5vbXo1dVH9ox sDJP2LmOT8a79pGY2N4/d7KchC1IykFt0vKXCJ7xpGdoc7LhJ9ZQlYNWpfOlqzooO0kB KgUtfRSz2dNNjQ1CmUcIq/ShvC+HYc2fOM+Z1Q3nZyai4NyZZYJOCbkaJ+rMdMvgpL6l w4+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726240460; x=1726845260; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wrqlu0MBnX/IwubC7JB6PnaVoLkJuNGIJqIpkcG99Z0=; b=Wcl3+IHJOYOPT1oUuhw/Yx6MCCCdtvTV2+oCNBAbfLhFTwtc1VvcUEPD1/217IVe1z EZ7BYSt6szGGSdm3r+f7lb1ywelTSmMglqdCQhFYSUY3+OEW6I/45GU6jzMNTLlhDunB BkutgXEpvnRD5+A1ujZexwEWYo+bRwlVEnCpuQe2+/i119/1qWkfZJssPV9qrkDryEyw r1b3d9P7wD/QP0fnbVY1VRHXH09ahd3e6ryRGJeJe64A9wUidb4JxA5DMLtPXiILMlC8 CJdq/nejLUvda5KCGLUwg28l6crY9TWQktRkUZd6K+QQnxvSX3bq6dvxinYaKFGIFQw6 dcAg== X-Gm-Message-State: AOJu0Yxo6k0KoU45ViUAnfZjb2uQn+O/N4L+OQSfnj57rc2gAon6/Zb/ QKE7AfaLRgqGjLGkgoeqq9sjc5dHiVWW+MY4qbW660FmHTvefha/AHVobjeuDYzpg1gylhJN/VS a X-Received: by 2002:a05:600c:4746:b0:426:6158:962d with SMTP id 5b1f17b1804b1-42d964d8612mr25076665e9.23.1726240460250; Fri, 13 Sep 2024 08:14:20 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42d9b16bfbfsm29152325e9.22.2024.09.13.08.14.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 08:14:20 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 14/27] hvf: Split up hv_vm_create logic per arch Date: Fri, 13 Sep 2024 16:13:58 +0100 Message-Id: <20240913151411.2167922-15-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240913151411.2167922-1-peter.maydell@linaro.org> References: <20240913151411.2167922-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32e.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-bounces+patch=linaro.org@nongnu.org From: Danny Canter This is preliminary work to split up hv_vm_create logic per platform so we can support creating VMs with > 64GB of RAM on Apple Silicon machines. This is done via ARM HVF's hv_vm_config_create() (and other APIs that modify this config that will be coming in future patches). This should have no behavioral difference at all as hv_vm_config_create() just assigns the same default values as if you just passed NULL to the function. Signed-off-by: Danny Canter Message-id: 20240828111552.93482-3-danny_canter@apple.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- include/sysemu/hvf_int.h | 1 + accel/hvf/hvf-accel-ops.c | 6 +----- target/arm/hvf/hvf.c | 9 +++++++++ target/i386/hvf/hvf.c | 5 +++++ 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/include/sysemu/hvf_int.h b/include/sysemu/hvf_int.h index 5b28d17ba1f..42ae18433f0 100644 --- a/include/sysemu/hvf_int.h +++ b/include/sysemu/hvf_int.h @@ -65,6 +65,7 @@ void assert_hvf_ok_impl(hv_return_t ret, const char *file, unsigned int line, #define assert_hvf_ok(EX) assert_hvf_ok_impl((EX), __FILE__, __LINE__, #EX) const char *hvf_return_string(hv_return_t ret); int hvf_arch_init(void); +hv_return_t hvf_arch_vm_create(MachineState *ms, uint32_t pa_range); int hvf_arch_init_vcpu(CPUState *cpu); void hvf_arch_vcpu_destroy(CPUState *cpu); int hvf_vcpu_exec(CPUState *); diff --git a/accel/hvf/hvf-accel-ops.c b/accel/hvf/hvf-accel-ops.c index ac08cfb9f32..dbebf209f48 100644 --- a/accel/hvf/hvf-accel-ops.c +++ b/accel/hvf/hvf-accel-ops.c @@ -61,10 +61,6 @@ HVFState *hvf_state; -#ifdef __aarch64__ -#define HV_VM_DEFAULT NULL -#endif - /* Memory slots */ hvf_slot *hvf_find_overlap_slot(uint64_t start, uint64_t size) @@ -324,7 +320,7 @@ static int hvf_accel_init(MachineState *ms) hv_return_t ret; HVFState *s; - ret = hv_vm_create(HV_VM_DEFAULT); + ret = hvf_arch_vm_create(ms, 0); assert_hvf_ok(ret); s = g_new0(HVFState, 1); diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index ace83671b59..19964d241ed 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -929,6 +929,15 @@ void hvf_arch_vcpu_destroy(CPUState *cpu) { } +hv_return_t hvf_arch_vm_create(MachineState *ms, uint32_t pa_range) +{ + hv_vm_config_t config = hv_vm_config_create(); + hv_return_t ret = hv_vm_create(config); + os_release(config); + + return ret; +} + int hvf_arch_init_vcpu(CPUState *cpu) { ARMCPU *arm_cpu = ARM_CPU(cpu); diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c index c9c64e29781..68dc5d9cf75 100644 --- a/target/i386/hvf/hvf.c +++ b/target/i386/hvf/hvf.c @@ -223,6 +223,11 @@ int hvf_arch_init(void) return 0; } +hv_return_t hvf_arch_vm_create(MachineState *ms, uint32_t pa_range) +{ + return hv_vm_create(HV_VM_DEFAULT); +} + int hvf_arch_init_vcpu(CPUState *cpu) { X86CPU *x86cpu = X86_CPU(cpu);