From patchwork Fri Jan 27 15:07:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Philippe Brucker X-Patchwork-Id: 647500 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp875662pvb; Fri, 27 Jan 2023 07:17:33 -0800 (PST) X-Google-Smtp-Source: AK7set921tp6KlK5N7Y7wt+PwAnjPQtz8ZQ1qmSbrey8PR854XkcibfiiuZcSR9z1GVJei6daFyd X-Received: by 2002:ac8:5e4f:0:b0:3b8:20e5:733b with SMTP id i15-20020ac85e4f000000b003b820e5733bmr4953955qtx.51.1674832652936; Fri, 27 Jan 2023 07:17:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674832652; cv=none; d=google.com; s=arc-20160816; b=PuGi12XZbpqUzaK2CJt8zo/nG9LBCVyaZiXLGto2X2XuIlgj3is7eoa1+wzVpNr7bS VEbxWXXZJ0fOaVRLupFR8u0BazrCZRxcin3s57cQcycQjOD0ffP5OL1MQm081/fPyQgU 1p3L7MjrqVNcQTQql68EIx+LnXNydXf9FX+ZvZ+gt5jtbTgGQ38bgcxblJoecw1PjQKk Rj2tQvAcZTT3D9vzdyqu+va0OiNjhnsdtZ2Q0AWt2haIYhYNQOPdveBczroRuYT1vNXv 5PTruYjmrLlyMincKWvlY7MbeiZCl9L7RORYjIsK+G7+C7WuJtzwiO7sVZPNWEx0GsLa /dlQ== 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=6ywqj05UIg3deHK3wVqj9WoSaWiZ3oE7Ec+4/n7JA1s=; b=kpViZzv7e9z4GY/bUPpnxFeM9T5z/Oe0bOZBtmuuQ9JCD03zlPxhreelTipHR8JmgD DLMiUys4MVDnmmjkmRNZadPBAqx+p13w5+oIm6irVdccnr1x3MZcgVBI7PePOdB0j5Gf uCYTPMCUU5QnJ2QKNrtA3mZ4pUZ0GCE2wYT04nlaTGwWFv0EklhICWT5R8cV9/iP5yJa PlKHNBAHjZkQv4Zvyput9r8/csBNUqRST+Bq8LQbQueCM5oKnIfP1CkkDjzyYJEmI2c7 /3/POr4JvVuZhs1z2VYaZa95rs6f5zBV4aqXk/Pz8rCuntCXhEfcuu/GDCY0VGovLXR8 ZIQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Mp/VxvNb"; 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 c8-20020ac87d88000000b003b7fd8ff2bbsi2533338qtd.161.2023.01.27.07.17.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 27 Jan 2023 07:17:32 -0800 (PST) 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="Mp/VxvNb"; 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 1pLQSX-0006MK-Td; Fri, 27 Jan 2023 10:16:10 -0500 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 1pLQSU-0006JX-8q for qemu-devel@nongnu.org; Fri, 27 Jan 2023 10:16:06 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pLQSQ-0007eU-GA for qemu-devel@nongnu.org; Fri, 27 Jan 2023 10:16:04 -0500 Received: by mail-wm1-x336.google.com with SMTP id q8so3675875wmo.5 for ; Fri, 27 Jan 2023 07:16:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=6ywqj05UIg3deHK3wVqj9WoSaWiZ3oE7Ec+4/n7JA1s=; b=Mp/VxvNbrTud0uPK6XiOgp1O24LiHNx5JpZvdntYF19EZ7D05iBgsRocJF6rvnltu/ IQO6+pZA7hr+JWnqCx+HH3ZcNYK1bnaH+lwPDWxXMdyW2Xa6ET5q9VVHFNdZjSr5gHWk FuPjLNnF2G4CMVVxEy8MgHfd20xfLLDFzkcSvBX74icFfiewHa55DZiojFlSGvhbZyvY NZV9e1SYdFSWjLmbWchV/LcvCG9sihrwNgBqwyKp+efwndyoeTbVGlFSRKeJy5SLn5FC MCBsaGp85SUjIW7AReu7omNLaJlSk8oFsd6LynejNFIDBxWPkSI9OLulG3SglLLZZxio Fg0g== 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=6ywqj05UIg3deHK3wVqj9WoSaWiZ3oE7Ec+4/n7JA1s=; b=FqL47L/ECACLoLiA4cgerkjF2tthCDVanaEuJ5/nXvjYnTovdrNkBvjzgaEZQ6EVAm hCeMASAn4TFYOWHUPhD0KleXBp7gWcXDKs8A5FOurT6PZQVUUfE9EpmONdIsD4oW9ROS 2qF7EMd97d+IlQIdYrsmM6VCTrVVy9k7d7MT29z6lubUCSIiu096o/AUDFfloRDwZq/E GclQzgu+tPQX1/pyuSdnq+RQt7aPy4ohPlB7kQz/2FZyZZm/0a2spcejAqt/4wtYZHFB YsywjOQtaGCJix9nBW/SuJdLsXmOLYs1vtuPZ8FnlziKS4wIhYz+q64qFWf4fM55Ywtv EgYA== X-Gm-Message-State: AFqh2kqEelDXXaJ2xj8IOQ9/ugA48sOQ7aY0sK5wPFD5IyNmY15E0b1Y wpjUVx03Ej1qx5q1AKTfea0WIA== X-Received: by 2002:a05:600c:1c9d:b0:3da:db4:6105 with SMTP id k29-20020a05600c1c9d00b003da0db46105mr40540319wms.37.1674832561473; Fri, 27 Jan 2023 07:16:01 -0800 (PST) Received: from localhost.localdomain (054592b0.skybroadband.com. [5.69.146.176]) by smtp.gmail.com with ESMTPSA id l7-20020a05600c47c700b003dc3bbdf518sm1656628wmo.21.2023.01.27.07.16.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Jan 2023 07:16:01 -0800 (PST) From: Jean-Philippe Brucker To: peter.maydell@linaro.org Cc: qemu-devel@nongnu.org, qemu-arm@nongnu.org, pbonzini@redhat.com, eblake@redhat.com, armbru@redhat.com, berrange@redhat.com, eduardo@habkost.net, alex.bennee@linaro.org, richard.henderson@linaro.org, Jean-Philippe Brucker Subject: [RFC PATCH 07/16] target/arm/kvm: Select RME VM type for the scratch VM Date: Fri, 27 Jan 2023 15:07:20 +0000 Message-Id: <20230127150727.612594-8-jean-philippe@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230127150727.612594-1-jean-philippe@linaro.org> References: <20230127150727.612594-1-jean-philippe@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=jean-philippe@linaro.org; helo=mail-wm1-x336.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 Although the VM type does not affect values probed from the scratch vCPU at the moment, it could later. Ensure we specify the right type when creating the temporary VM. Signed-off-by: Jean-Philippe Brucker --- Does the PA size need changing as well? --- target/arm/kvm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/target/arm/kvm.c b/target/arm/kvm.c index fcddead4fe..d8655d9041 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -70,6 +70,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) { @@ -79,8 +80,10 @@ 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, vm_type | max_vm_pa_size); } while (vmfd == -1 && errno == EINTR); if (vmfd < 0) { goto err;