From nobody Wed May 1 00:56:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.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 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1541686908575664.7019324455764; Thu, 8 Nov 2018 06:21:48 -0800 (PST) Received: from localhost ([::1]:57055 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gKlBj-0005CW-61 for importer@patchew.org; Thu, 08 Nov 2018 09:21:39 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53116) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gKlAB-0004Vm-DK for qemu-devel@nongnu.org; Thu, 08 Nov 2018 09:20:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gKlA8-00075h-GK for qemu-devel@nongnu.org; Thu, 08 Nov 2018 09:20:03 -0500 Received: from mail-io1-xd42.google.com ([2607:f8b0:4864:20::d42]:36690) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gKlA8-000711-9O for qemu-devel@nongnu.org; Thu, 08 Nov 2018 09:20:00 -0500 Received: by mail-io1-xd42.google.com with SMTP id o19-v6so14704895iod.3 for ; Thu, 08 Nov 2018 06:19:52 -0800 (PST) Received: from serve.minyard.net ([47.184.170.128]) by smtp.gmail.com with ESMTPSA id v4-v6sm1305342iol.77.2018.11.08.06.19.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Nov 2018 06:19:48 -0800 (PST) Received: from t430.minyard.net (t430m.minyard.net [192.168.27.3]) by serve.minyard.net (Postfix) with ESMTPA id 7FDD78FC; Thu, 8 Nov 2018 08:19:47 -0600 (CST) Received: by t430.minyard.net (Postfix, from userid 1000) id 965A2301151; Thu, 8 Nov 2018 08:19:46 -0600 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FpOujx9Bk417L4EdcLHsX3Vn6UpY1D12FCl09w3NAtg=; b=qxI7mQ0yswARL0T7vBhqjctL9APszI385cMRqPRWFNjBP03LEwkxiMdKLmyWQn0Czo 3x84qvsbaZKI2Rhpa0OEOASKwQwBymr1pSGeZJwny58mBT4InXzGl194txCtprjYuADP RlX0950vOydPpeH4qI0fkNqTLt1PYKla+9b43iXzUjCbUxIXzuqbrKNa/skPTsyrHOPX Nab+pQeLiDu4Mra4oa7FuJp9MIh80LmdEYPGXK/baLqJ8PBKD0bq5UZYVHAl39uf2DSH lgFNyJ1axuVuj4awmCjzL9T5SIH6xs3/bbF+iFSnTvoqR/QkYx4ZNzTCrAdEjpxHBUaB WkdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=FpOujx9Bk417L4EdcLHsX3Vn6UpY1D12FCl09w3NAtg=; b=bqzwh74x7xwAbxaVVCamFsU7Yy5cCn1HidFF+3+FrSE9/pBinYGIzFM/zugi5CFDEt u7142sIEQFisvAlssgRwUnQ9KebpvktLKYV0p65aMjvRUkvEqt+1XylrjXnG79Ie4553 uwa8JnAtORBVHStmbB7dBtWu4Og+zD07wc9VWOAOgtQ8dXmHM6YxSvOzzf7ak3Z9kLDs ZoLcVcpgforYNsa6JopAgARbYxKkSHNTakoJxd1t8XpjL7xl6oQ8VE1UOoHuwE8MUU0r J3cyUnoO22pKL+rPNrOtnk3V3N1Y+H6wdGvJ0qaibyDDutN/jQD8tgilCd4sMpe8J2ru x53Q== X-Gm-Message-State: AGRZ1gKZWx16EqXQ0FiqKNPrey89GvUwQwet6d6Mz8fKk7/4ieHJ2+v7 sEhiCdWXR8j3fLqoDaCHUodLc3w= X-Google-Smtp-Source: AJdET5ewd4vXmq2ji6tXhm8VXNDoym/QqKCJKkkk0DgkLqSmStjAk16W/YW0Ixa68MDITeyj0DhiTA== X-Received: by 2002:a6b:1742:: with SMTP id 63-v6mr3775631iox.158.1541686791506; Thu, 08 Nov 2018 06:19:51 -0800 (PST) From: minyard@acm.org To: qemu-devel@nongnu.org Date: Thu, 8 Nov 2018 08:19:43 -0600 Message-Id: <20181108141944.15769-2-minyard@acm.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181108141944.15769-1-minyard@acm.org> References: <20181108141944.15769-1-minyard@acm.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::d42 Subject: [Qemu-devel] [PATCH 1/2] qdev: Add a no default uuid property 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: , Cc: Corey Minyard , Fam Zheng , "Michael S . Tsirkin" , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Corey Minyard This is for IPMI, which will behave differently if the UUID is not set. Signed-off-by: Corey Minyard Cc: Fam Zheng Cc: Michael S. Tsirkin Cc: Marc-Andr=C3=A9 Lureau --- include/hw/qdev-properties.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index 4f60cc88f3..d614f931c9 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -226,6 +226,13 @@ extern const PropertyInfo qdev_prop_off_auto_pcibar; .set_default =3D true, \ } =20 +#define DEFINE_PROP_UUID_NODEFAULT(_name, _state, _field) { \ + .name =3D (_name), \ + .info =3D &qdev_prop_uuid, \ + .offset =3D offsetof(_state, _field) \ + + type_check(QemuUUID, typeof_field(_state, _field)), \ + } + #define DEFINE_PROP_END_OF_LIST() \ {} =20 --=20 2.17.1 From nobody Wed May 1 00:56:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.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 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1541686910285410.177201472394; Thu, 8 Nov 2018 06:21:50 -0800 (PST) Received: from localhost ([::1]:57058 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gKlBt-0005Ki-4E for importer@patchew.org; Thu, 08 Nov 2018 09:21:49 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53196) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gKlAF-0004Wa-Vo for qemu-devel@nongnu.org; Thu, 08 Nov 2018 09:20:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gKlAA-00078G-2z for qemu-devel@nongnu.org; Thu, 08 Nov 2018 09:20:07 -0500 Received: from mail-it1-x142.google.com ([2607:f8b0:4864:20::142]:52287) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gKlA9-00070R-Oa for qemu-devel@nongnu.org; Thu, 08 Nov 2018 09:20:01 -0500 Received: by mail-it1-x142.google.com with SMTP id t190-v6so1743441itb.2 for ; Thu, 08 Nov 2018 06:19:50 -0800 (PST) Received: from serve.minyard.net ([47.184.170.128]) by smtp.gmail.com with ESMTPSA id v129-v6sm1965022ita.38.2018.11.08.06.19.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Nov 2018 06:19:48 -0800 (PST) Received: from t430.minyard.net (t430m.minyard.net [192.168.27.3]) by serve.minyard.net (Postfix) with ESMTPA id 9A473D3B; Thu, 8 Nov 2018 08:19:47 -0600 (CST) Received: by t430.minyard.net (Postfix, from userid 1000) id BF393301152; Thu, 8 Nov 2018 08:19:46 -0600 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AP6xD02RFFacHTqEUqShMxIasfMNNWi7Dq9ljJglfnE=; b=uuUgvATI6lJn6Wz13XVeykRq5gw7rsw2uyTk1n6GASmKwen89yIAU+6vQsynK/FhVL HKHpam7KP/Xlnzrg36MjkKkVbMcg/vJlPHoU+4i3GAEBpBgmgFwQ02HxIQzvGHye+EMP NTnGvRRmbmRIH9Tef8waaYSw4ckZ29PFzPKV6ZRNl48/puAXkG+l/DXdKjz1NNmWhmEh Mq6HVEYwZ1DC2Oen81Bi/wYy7tQbTTebPpc7iE+kr1av5ow3qys5U5QBsd0rg3yRyN0U OZUG4fML6S9NYSHAJfV8Wz5/YTiBHXutXJWoI++8FyjYHiq9ivKfsLL+HRsl6iCTgX5k VUQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=AP6xD02RFFacHTqEUqShMxIasfMNNWi7Dq9ljJglfnE=; b=PUt9pM5Fpa6N7raAPPFIxV2Mxt3hpzPkoVtWwEOOLp8A/Z0AnJ7kJaPZ7OAsx3H+bq B8t/yeeluTtxPQMjF/+KHqVq0mv/urXyrGW+zZeNIM0u5mwREm7AgFwKqoEOhzAWTwQ7 O14YsXkm6cikYiEchS7fVDGb02c3ptryak59ggqqcdGR33yQ3kusVB4ZoYByHFqHRM7Z o1w8ejDqhJZvYA+VgMsFuiNcekHtTf8+8dw/f0HQZtVYYeOQ7ftWe4bTeTOwzHisU5On /CVChr0azwnPyRjOPy6WLC/1MnYsGNjifwrbfFs5tRBTKgddYU+IuhPSFhG+LMQQaHN7 Jh9g== X-Gm-Message-State: AGRZ1gLERqnTec865VZH9Ub2mQRAer2nMgGtHWDfFnlnJfCbzdrp8BdR a6pLFSrjCKTZgePemV9myA== X-Google-Smtp-Source: AJdET5eVP7jMzCG5yRA7/OSAtLWwRl1Ma1eDe8bSPWvC98ddfOZio7mOv97S2NXpacQOniCOtiXPOw== X-Received: by 2002:a05:660c:284:: with SMTP id s4mr1131418itl.162.1541686789747; Thu, 08 Nov 2018 06:19:49 -0800 (PST) From: minyard@acm.org To: qemu-devel@nongnu.org Date: Thu, 8 Nov 2018 08:19:44 -0600 Message-Id: <20181108141944.15769-3-minyard@acm.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181108141944.15769-1-minyard@acm.org> References: <20181108141944.15769-1-minyard@acm.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::142 Subject: [Qemu-devel] [PATCH 2/2] ipmi: Add a UUID device property 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: , Cc: Corey Minyard , Fam Zheng , "Michael S . Tsirkin" , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Corey Minyard Using the UUID that qemu generates probably isn't the best thing to do, allow it to be passed in via properties, and use QemuUUID for the type. If the UUID is not set, return an unsupported command error. This way we are not providing an all-zero (or randomly generated) GUID to the IPMI user. This lets the host fall back to the other method of using the get device id command to determind the BMC being accessed. Signed-off-by: Corey Minyard Cc: C=C3=A9dric Le Goater Cc: David Gibson Cc: Michael S. Tsirkin Cc: Paolo Bonzini --- hw/ipmi/ipmi_bmc_sim.c | 22 ++++++++++++++-------- qemu-options.hx | 10 +++++++--- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/hw/ipmi/ipmi_bmc_sim.c b/hw/ipmi/ipmi_bmc_sim.c index 9b509f829b..b88c021977 100644 --- a/hw/ipmi/ipmi_bmc_sim.c +++ b/hw/ipmi/ipmi_bmc_sim.c @@ -220,7 +220,7 @@ struct IPMIBmcSim { uint8_t restart_cause; =20 uint8_t acpi_power_state[2]; - uint8_t uuid[16]; + QemuUUID uuid; =20 IPMISel sel; IPMISdr sdr; @@ -936,8 +936,19 @@ static void get_device_guid(IPMIBmcSim *ibs, { unsigned int i; =20 + /* An uninitialized uuid is all zeros, use that to know if it is set. = */ for (i =3D 0; i < 16; i++) { - rsp_buffer_push(rsp, ibs->uuid[i]); + if (ibs->uuid.data[i]) { + goto uuid_set; + } + } + /* No uuid is set, return an error. */ + rsp_buffer_set_error(rsp, IPMI_CC_INVALID_CMD); + return; + + uuid_set: + for (i =3D 0; i < 16; i++) { + rsp_buffer_push(rsp, ibs->uuid.data[i]); } } =20 @@ -1979,12 +1990,6 @@ static void ipmi_sim_realize(DeviceState *dev, Error= **errp) ibs->acpi_power_state[0] =3D 0; ibs->acpi_power_state[1] =3D 0; =20 - if (qemu_uuid_set) { - memcpy(&ibs->uuid, &qemu_uuid, 16); - } else { - memset(&ibs->uuid, 0, 16); - } - ipmi_init_sensors_from_sdrs(ibs); register_cmds(ibs); =20 @@ -2004,6 +2009,7 @@ static Property ipmi_sim_properties[] =3D { DEFINE_PROP_UINT8("fwrev2", IPMIBmcSim, fwrev2, 0), DEFINE_PROP_UINT32("mfg_id", IPMIBmcSim, mfg_id, 0), DEFINE_PROP_UINT16("product_id", IPMIBmcSim, product_id, 0), + DEFINE_PROP_UUID_NODEFAULT("guid", IPMIBmcSim, uuid), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/qemu-options.hx b/qemu-options.hx index 38c7a978c1..37e57e27d0 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -470,7 +470,7 @@ possible drivers and properties, use @code{-device help= } and @code{-device @var{driver},help}. =20 Some drivers are: -@item -device ipmi-bmc-sim,id=3D@var{id}[,slave_addr=3D@var{val}][,sdrfile= =3D@var{file}][,furareasize=3D@var{val}][,furdatafile=3D@var{file}] +@item -device ipmi-bmc-sim,id=3D@var{id}[,slave_addr=3D@var{val}][,sdrfile= =3D@var{file}][,furareasize=3D@var{val}][,furdatafile=3D@var{file}][,guid= =3D@var{uuid}] =20 Add an IPMI BMC. This is a simulation of a hardware management interface processor that normally sits on a system. It provides @@ -483,8 +483,8 @@ controllers. If you don't know what this means, it is = safe to ignore it. =20 @table @option -@item bmc=3D@var{id} -The BMC to connect to, one of ipmi-bmc-sim or ipmi-bmc-extern above. +@item id=3D@var{id} +The BMC id for interfaces to use this device. @item slave_addr=3D@var{val} Define slave address to use for the BMC. The default is 0x20. @item sdrfile=3D@var{file} @@ -493,6 +493,10 @@ file containing raw Sensor Data Records (SDR) data. Th= e default is none. size of a Field Replaceable Unit (FRU) area. The default is 1024. @item frudatafile=3D@var{file} file containing raw Field Replaceable Unit (FRU) inventory data. The defau= lt is none. +@item guid=3D@var{uuid} +value for the GUID for the BMC, in standard UUID format. If this is set, +get "Get GUID" command to the BMC will return it. Otherwise "Get GUID" +will return an error. @end table =20 @item -device ipmi-bmc-extern,id=3D@var{id},chardev=3D@var{id}[,slave_addr= =3D@var{val}] --=20 2.17.1