From nobody Fri Dec 19 04:38:19 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1551805493868931.7890160580539; Tue, 5 Mar 2019 09:04:53 -0800 (PST) Received: from localhost ([127.0.0.1]:45918 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h1DUn-0004It-HI for importer@patchew.org; Tue, 05 Mar 2019 12:04:49 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54665) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h1DHd-0001fI-Vw for qemu-devel@nongnu.org; Tue, 05 Mar 2019 11:51:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h1DHc-0000yK-RL for qemu-devel@nongnu.org; Tue, 05 Mar 2019 11:51:13 -0500 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:38098) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h1DHc-0000xg-Jz for qemu-devel@nongnu.org; Tue, 05 Mar 2019 11:51:12 -0500 Received: by mail-wm1-x343.google.com with SMTP id a188so3230617wmf.3 for ; Tue, 05 Mar 2019 08:51:12 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id 2sm10071495wrg.89.2019.03.05.08.51.10 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Mar 2019 08:51:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=dVQd8TzX7QktWbyZTi8tAwCyN/rm2Ob7DVUS8CvABV0=; b=Sowll9acxGdHiOOpyzwEAavT6byQz+5SIfvOPEMb4O+Dh4JyyaSYqui06+me5Xmx1G HOoP/3n/AP7I9jMdYMrG2sU0NjhvD0o8w4JJ56WVgGTR2kMz8g5blYewEqyoUeyvcSnn 8nwUUnyW160EoDfM7uxEUelEiRTVbrM6OyubcgkI6EoCf/1WdbnRtbjZmdJHIEnqYZj6 2l06wXO5hXgMf0N4CJ2Jc+XsN/sZicp3ScepUGVIon3uoDcTBQ51uK9Vu4oraLX5aOO5 x2Xk34JnbatzUeYG8btisNm8gkkmavq2xvyE3RPwc8y12uevOW5TG8GXsk05ZLo0NkYE cypw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dVQd8TzX7QktWbyZTi8tAwCyN/rm2Ob7DVUS8CvABV0=; b=W0Lu1NrmMbmOraeHqSHgYFjfCGe6LcfkGwz2tzU1qHFmvKzvriGtsOcBf+tSEK6FF7 g751oPSemv9ydof+AOGJmAUg6mf7r3TM9ZFIdQiRUH0XfZxJmmMrHEkUPnLliTBeATyz y315SNug8fX0mWoDlyomIpswYXyT00D+QocLV7mRBUFURBpDjo6DuHoKL2NBlyWaEkLn IoWv3RFLC7syNPqWoaPXzirca04RE3pepLLfV9Q8Hd7c+Pw9leGhJx0xFDRyAoDdLblZ rN36mUOf/9Lt4WA1QohvmuGq3PbVgxbRTLedd2DG6HBQySpK7EoQoPJBKCy4ntCe5HYg OBGg== X-Gm-Message-State: APjAAAVqF5Vjt0X0gpa2voZTlY93QbwetaUIQXsasCEg0IrDJqSOh+4o qBUp4zrRU1jMnDpVmoUWsRAtbCCOqkg= X-Google-Smtp-Source: APXvYqykTWRHv+0XKdfk9IYg8P+CyYmIeieHQf3wTVPgshNuZmdWytxrWvkCG8aZ0P8Y75PaaPxQFA== X-Received: by 2002:a1c:1b8a:: with SMTP id b132mr3317505wmb.138.1551804671285; Tue, 05 Mar 2019 08:51:11 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Date: Tue, 5 Mar 2019 16:50:44 +0000 Message-Id: <20190305165051.26860-16-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190305165051.26860-1-peter.maydell@linaro.org> References: <20190305165051.26860-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::343 Subject: [Qemu-devel] [PULL 15/22] hw/boards: Add a MachineState parameter to kvm_type callback X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Eric Auger On ARM, the kvm_type will be resolved by querying the KVMState. Let's add the MachineState handle to the callback so that we can retrieve the KVMState handle. in kvm_init, when the callback is called, the kvm_state variable is not yet set. Signed-off-by: Eric Auger Acked-by: David Gibson Reviewed-by: Peter Maydell Reviewed-by: Igor Mammedov Message-id: 20190304101339.25970-5-eric.auger@redhat.com [ppc parts] Reviewed-by: Peter Maydell Reviewed-by: Igor Mammedov Signed-off-by: Peter Maydell --- include/hw/boards.h | 5 ++++- accel/kvm/kvm-all.c | 2 +- hw/ppc/mac_newworld.c | 3 +-- hw/ppc/mac_oldworld.c | 2 +- hw/ppc/spapr.c | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/include/hw/boards.h b/include/hw/boards.h index 21212f08590..9690c71a6d7 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -156,6 +156,9 @@ typedef struct { * should instead use "unimplemented-device" for all memory ranges where * the guest will attempt to probe for a device that QEMU doesn't * implement and a stub device is required. + * @kvm_type: + * Return the type of KVM corresponding to the kvm-type string option or + * computed based on other criteria such as the host kernel capabilitie= s. */ struct MachineClass { /*< private >*/ @@ -171,7 +174,7 @@ struct MachineClass { void (*init)(MachineState *state); void (*reset)(void); void (*hot_add_cpu)(const int64_t id, Error **errp); - int (*kvm_type)(const char *arg); + int (*kvm_type)(MachineState *machine, const char *arg); =20 BlockInterfaceType block_default_type; int units_per_default_bus; diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index fd92b6f3754..241db496c3d 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -1593,7 +1593,7 @@ static int kvm_init(MachineState *ms) =20 kvm_type =3D qemu_opt_get(qemu_get_machine_opts(), "kvm-type"); if (mc->kvm_type) { - type =3D mc->kvm_type(kvm_type); + type =3D mc->kvm_type(ms, kvm_type); } else if (kvm_type) { ret =3D -EINVAL; fprintf(stderr, "Invalid argument kvm-type=3D%s\n", kvm_type); diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index 98461052ac0..97e88171450 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -564,8 +564,7 @@ static char *core99_fw_dev_path(FWPathProvider *p, BusS= tate *bus, =20 return NULL; } - -static int core99_kvm_type(const char *arg) +static int core99_kvm_type(MachineState *machine, const char *arg) { /* Always force PR KVM */ return 2; diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index 284431ddd68..cc1e463466d 100644 --- a/hw/ppc/mac_oldworld.c +++ b/hw/ppc/mac_oldworld.c @@ -420,7 +420,7 @@ static char *heathrow_fw_dev_path(FWPathProvider *p, Bu= sState *bus, return NULL; } =20 -static int heathrow_kvm_type(const char *arg) +static int heathrow_kvm_type(MachineState *machine, const char *arg) { /* Always force PR KVM */ return 2; diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index b6a571b6f18..d7850ada7df 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -3023,7 +3023,7 @@ static void spapr_machine_init(MachineState *machine) } } =20 -static int spapr_kvm_type(const char *vm_type) +static int spapr_kvm_type(MachineState *machine, const char *vm_type) { if (!vm_type) { return 0; --=20 2.20.1