Message ID | 20240419155709.318866-12-jean-philippe@linaro.org |
---|---|
State | Superseded |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:adf:e6ca:0:b0:346:15ad:a2a with SMTP id y10csp1149364wrm; Fri, 19 Apr 2024 09:02:35 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWwPFxs+LRp6cPwfbETEYp8FmJFNfefhljlEp2KhHvcWtnuhYKhfSy4s+Jck1pD3WPkz34r+NVKr8ugc1Ck46rE X-Google-Smtp-Source: AGHT+IHhGPMPXtRjgJ5t4E6heMrOHFgXMIEpx1VybcDNA3Io5kV8LIe7knRikNZnwHd22S632Ru/ X-Received: by 2002:adf:ce06:0:b0:347:f94b:94d8 with SMTP id p6-20020adfce06000000b00347f94b94d8mr2228290wrn.62.1713542554997; Fri, 19 Apr 2024 09:02:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713542554; cv=none; d=google.com; s=arc-20160816; b=XOrNDQpx890nnswZ9M/IxYI9SV4s2JUmamAnr3iFPXfCEaNgitzmmtEcK6W820XUOA Xj1D2LNwhSSPTeKWy6eeSwTSs0qAO214XmCM1tLMNjY7rMJERgF6IxfAxAn1jQa9usWI 2kHoDuOzC2XloNnAP+fdvJvvyRypgmXEB/iKBfa1BO4SxAHnNOX8KTA4Xi3kz+S9G81d g0vh+/q9g7NBsCjllEqBFxV1qOtz41lLEvwbbeKutPONAGRrxIzPdtPfn08c//CaaPy7 yee/wGrs4XmHocEbLsm+DYMXQtzk+S6mPDW7YeQdEufyP2FfDsiuy4Fcs3v2cxqHH0k9 eBEQ== 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=RSfgbPCTP9EyXuV3juP9dkL7EJuQyUK18eBXqNLqpbo=; fh=R5zPEgcAWyZwVS23iO9TglBEIQTAC2Z57qr1u6DJWhs=; b=vZ7UKTKh9A/jOMnhIYZ+54O1yJdDtWzcmV0Vrv4d36BqiMALC8AO0EKUuyzCKfzmnI /8ybyrokzVxSOzwWlEBzuLY5g6RZbDCz2CGas4sqKGLX3VgQSXzIrpLZhLr0qdx6Q63/ hx8KuatPMtUlhblxmBekxiJddGe9R8jwAnT8/A6+iL0Kq4ghHmPRuMtZlvlKmMzH8Fc3 tPxiI2F/8ZD2lkm1Lx9aU485u63yA7TmNmhHDSwlCL3PuT32aU1GW6vjjqbDEOA9jcJT X/uv2OX9HNLcVvLUg4LYvIoITr+HFwylSw3MiC+RrWr0FFqUqwnVqMvGzabMLj7EDN1e waRw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SQkKAnNo; 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: <qemu-devel-bounces+patch=linaro.org@nongnu.org> Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m20-20020a056000181400b003468c63c424si2043737wrh.365.2024.04.19.09.02.34 for <patch@linaro.org> (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 19 Apr 2024 09:02:34 -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=SQkKAnNo; 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 <qemu-devel-bounces@nongnu.org>) id 1rxqfP-0001kM-Bp; Fri, 19 Apr 2024 12:00:47 -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 <jean-philippe@linaro.org>) id 1rxqee-0001Be-H1 for qemu-devel@nongnu.org; Fri, 19 Apr 2024 12:00:01 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <jean-philippe@linaro.org>) id 1rxqeY-00016x-W9 for qemu-devel@nongnu.org; Fri, 19 Apr 2024 11:59:59 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-417f5268b12so23476665e9.1 for <qemu-devel@nongnu.org>; Fri, 19 Apr 2024 08:59:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713542393; x=1714147193; darn=nongnu.org; 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=RSfgbPCTP9EyXuV3juP9dkL7EJuQyUK18eBXqNLqpbo=; b=SQkKAnNo6T7f4A8fdejdCV0cnzTGOc55u0SIOm2zprUiRGqXkBoA+AxUpKBWorEOtp DienCbhrcU4IG1uuHaOGqNbt/NgByoRUPPbinsDm/MLCnHJFudci71GvCXFylqzMkMNi yStkjLgDJNTmxO7i9/xz3CUlf4d2oVLKa6wxcWG5CsgQRehT+zkhG6RnkgbomwyaHAU+ M+C8iSGKDQoavfF+OY/v66iMdJ0jTN2QVjlCKTu2UXaRnku/3tgam+EZRqkPid4IxJZH b48odklLFQHXoXGRawRcQEM1hNaUbuYJX0yEMKWjPbjxVtkPO76LKW1xBIiJGaLONvvO aIKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713542393; x=1714147193; 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=RSfgbPCTP9EyXuV3juP9dkL7EJuQyUK18eBXqNLqpbo=; b=YAYc2Qh6of15KXq8h7PaDJqs06kC2L/tO7g+A7goG5fCggxKawf4eArFrKvoxAPy+t JmPiwgLRODohqECYQqCRY/DyTMcu5MUHR0PUty5+0rK26UFoYFmZCd48HcJbogDssj2i cERf7hUH1hMFsHXT+VgGkedN2Y0eqVqzKys/lxXKu5F5yapTevn5+G4BU7ZEqirFoVZ/ LFSgEraaU/Nf/aEmmeNNYs2Dnb+0I1ksP6pCwIPsBxTEqzOJll0Vc/sK32lCuJhnOKd1 GmfHLgZBLxa06OkRziaa2bPmgLreI1Y/3xw3hMjDOelIIrlgjoC44pTGTbHwYkmuyRDR aoyw== X-Forwarded-Encrypted: i=1; AJvYcCXVL3lMB6lMnw0q/RFXYPKKEvR7xCz/HeIfi+PNgt9VUXpEjrfthPZHZas7TC7HjOc413AG8G2V4dJB9Og3dCus+unG6J8= X-Gm-Message-State: AOJu0Yylcvnz3P2cqodPZiLzrWddSrdFaJJJLGszGinH8vL7ovFk5nka 9Xm+9jgJS9Ptz7uF30FIgmjXe3+x3FYLJKe5CUSSbOYvVThgWhBwIXUtG2e8R+M= X-Received: by 2002:a05:6000:10c:b0:34a:4b5b:a3d with SMTP id o12-20020a056000010c00b0034a4b5b0a3dmr2104134wrx.7.1713542393565; Fri, 19 Apr 2024 08:59:53 -0700 (PDT) Received: from localhost.localdomain ([2.221.137.100]) by smtp.gmail.com with ESMTPSA id p13-20020adfe60d000000b00349b73143e7sm4793089wrm.75.2024.04.19.08.59.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 08:59:53 -0700 (PDT) From: Jean-Philippe Brucker <jean-philippe@linaro.org> To: peter.maydell@linaro.org, richard.henderson@linaro.org Cc: philmd@linaro.org, pbonzini@redhat.com, alex.bennee@linaro.org, qemu-devel@nongnu.org, qemu-arm@nongnu.org, Jean-Philippe Brucker <jean-philippe@linaro.org> Subject: [PATCH v2 10/22] target/arm/kvm: Create scratch VM as Realm if necessary Date: Fri, 19 Apr 2024 16:56:58 +0100 Message-ID: <20240419155709.318866-12-jean-philippe@linaro.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240419155709.318866-2-jean-philippe@linaro.org> References: <20240419155709.318866-2-jean-philippe@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=jean-philippe@linaro.org; helo=mail-wm1-x335.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: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org |
Series |
arm: Run CCA VMs with KVM
|
expand
|
diff --git a/target/arm/kvm.c b/target/arm/kvm.c index 3a2233ec73..6d368bf442 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -104,6 +104,7 @@ bool kvm_arm_create_scratch_host_vcpu(const uint32_t *cpus_to_try, { int ret = 0, kvmfd = -1, vmfd = -1, cpufd = -1; int max_vm_pa_size; + int vm_type; kvmfd = qemu_open_old("/dev/kvm", O_RDWR); if (kvmfd < 0) { @@ -113,8 +114,9 @@ bool kvm_arm_create_scratch_host_vcpu(const uint32_t *cpus_to_try, if (max_vm_pa_size < 0) { max_vm_pa_size = 0; } + vm_type = kvm_arm_rme_vm_type(MACHINE(qdev_get_machine())); do { - vmfd = ioctl(kvmfd, KVM_CREATE_VM, max_vm_pa_size); + vmfd = ioctl(kvmfd, KVM_CREATE_VM, max_vm_pa_size | vm_type); } while (vmfd == -1 && errno == EINTR); if (vmfd < 0) { goto err;
Some ID registers have a different value for a Realm VM, for example ID_AA64DFR0_EL1 contains the number of breakpoints/watchpoints implemented by RMM instead of the hardware. Even though RMM is in charge of setting up most Realm registers, KVM still provides GET_ONE_REG interface on a Realm VM to probe the VM's capabilities. KVM only reports the maximum IPA it supports, but RMM may support smaller sizes. If the VM creation fails with the value returned by KVM, then retry with the smaller working address. This needs a better solution. Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> --- target/arm/kvm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)