From nobody Fri Sep 20 22:14:55 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1561639896; cv=none; d=zoho.com; s=zohoarc; b=U0T3VfSnooDOGNbG4QFGjkS/eU5eKchZgkqMp2bA8y8rBTzLzLFfh/wQfPTonTtiSswAPbsQ7sUFQfFnc42kas7X/zwbPz3I/y3cenvtv6xRM5CXZ4+5NL+BW7WbJsPIZNvbBOvzDpTt26saIqWwv+C359BkF6aZJlJ4p7MakcI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561639896; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=NO976jdjcFbYo6B4xUhDqG/yyhIQxVSBAlIMZVWwaus=; b=WvzI5dhxEUUMnn/shvR6VevtHUtp0uaRWUeJcjPDkNBvWTgv0rBv4ZdzmaDhWDhdwnJU2eiJ+Q0uVbpwzFIrutL4J2q0xXZaXgq/BEOylJkom9zTVA5ff56/To0jqxAlbGjMxQKhO52wW9ZI2vyKelFWaBWT5B8wMsSMNx+1EHI= ARC-Authentication-Results: i=1; mx.zoho.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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1561639896101155.77067567012546; Thu, 27 Jun 2019 05:51:36 -0700 (PDT) Received: from localhost ([::1]:50442 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hgTsD-0000gq-56 for importer@patchew.org; Thu, 27 Jun 2019 08:51:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53787) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hgTpb-0006yI-2p for qemu-devel@nongnu.org; Thu, 27 Jun 2019 08:49:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hgTpT-0003iI-7g for qemu-devel@nongnu.org; Thu, 27 Jun 2019 08:48:50 -0400 Received: from mail-oi1-x22a.google.com ([2607:f8b0:4864:20::22a]:38894) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hgTpS-0003Us-Ej for qemu-devel@nongnu.org; Thu, 27 Jun 2019 08:48:42 -0400 Received: by mail-oi1-x22a.google.com with SMTP id v186so1467825oie.5 for ; Thu, 27 Jun 2019 05:48:26 -0700 (PDT) Received: from serve.minyard.net ([47.184.134.43]) by smtp.gmail.com with ESMTPSA id y83sm773314oig.41.2019.06.27.05.48.25 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 27 Jun 2019 05:48:25 -0700 (PDT) Received: from t430.minyard.net (unknown [IPv6:2001:470:b8f6:1b:8437:2822:278a:bbee]) by serve.minyard.net (Postfix) with ESMTPA id 8D8761805A7; Thu, 27 Jun 2019 12:48:24 +0000 (UTC) Received: by t430.minyard.net (Postfix, from userid 1000) id 4AD2E302332; Thu, 27 Jun 2019 07:48:24 -0500 (CDT) 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=NO976jdjcFbYo6B4xUhDqG/yyhIQxVSBAlIMZVWwaus=; b=dUpOwAUbwktlxlpmYLv8s2PXazcdMOTqU52XVwiFrgze3ljKHq8Wh6mpvEc//w4vd+ PTHHA2Go0hwHsGIIHYw9Nmjtnh0qwV59if2mLeIjO+YEa+NDrfmJkU+cwEczgJ1wOUS+ b/p/9jf9gOnneWNsg7WhsdlTbHx+RO49vvm5s6ztkn1EcREGeEKzJDydLtmI6907e12b R6HCvfsDNYhZJPwpnlCCuy34mg8tKCnWyNgRp/aY3cevXf6q2yOm4K2MVe+mB/fhuln+ oXstMsImpVC1kgu6F8xFg0VCIrBU/61IO4SwlVH7mu2B3FEgdlGF34cEE9+eewz2FhdP xDzw== 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=NO976jdjcFbYo6B4xUhDqG/yyhIQxVSBAlIMZVWwaus=; b=Tl65RWvmepFpsJiZtoUgSZ4mwlUD4dm0ceubTe8CYOgABwKvKt7FqwzVmKK9ngqA5k qCtoZJN0DfXy9+8XeNuEJsVflwEDcTjDHeFQ7jgFVX6LoWNExaahpILKr9LIvjiRQH9a QTP/DIP7r7QvT98JFRdH9+1kW9jocau/bCnwzP9xTY3fKXr29CrkUW4MiYSsKFVmEQMu Lv5pYHuzwzQWWyFwV/aHDkeyaYqQasrDX3lTn8olkTwuFEOchqQ5kJsyZH39B+x6rJ+I ipdDDwjPkbl1N0QPBexV+XWRfwt1eZW1SyhrObaTyE+FEOiLMa9K4hJcIytp975cIoJM 8UZg== X-Gm-Message-State: APjAAAXElyh9xgaxXR03A/XrCkXSFRR+H/5gJgzw/lUcJyDt+uJoAK4n BDAPfJ218Cs0x9lX7UvVEw== X-Google-Smtp-Source: APXvYqyIvQgZWTnN1iSptbWjSkp0dPm2qY6XFbUBGW+Tm6KVSl4Psskuz9fLjVqJmCpS4mbsfONy0g== X-Received: by 2002:aca:c256:: with SMTP id s83mr1991984oif.111.1561639705721; Thu, 27 Jun 2019 05:48:25 -0700 (PDT) From: minyard@acm.org To: Peter Maydell Date: Thu, 27 Jun 2019 07:48:14 -0500 Message-Id: <20190627124815.29536-2-minyard@acm.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190627124815.29536-1-minyard@acm.org> References: <20190627124815.29536-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::22a Subject: [Qemu-devel] [PULL 1/2] qdev: Add a no default uuid property X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Corey Minyard , Fam Zheng , QEMU Developers , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S . Tsirkin" 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 1eae5ab056..7fd887af84 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -237,6 +237,13 @@ extern const PropertyInfo qdev_prop_pcie_link_width; .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 Fri Sep 20 22:14:55 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1561639899; cv=none; d=zoho.com; s=zohoarc; b=JtSktwSvoy5rp/LciY3LA1TiIkyFk8jQwImocIMIbR7L1yPEyLzrDncG+0sdfaIhqyFFCWi9SoSYl/1AfkZrjflkt+1YvirlfZGWlQsfOrlF2zgUaViymeLNmsUMNDW8HYaZNvB0JT1yl7r4SXh5tj7CWPC7ouJQ2RokqVMlvBU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561639899; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Mz9dF6CfjXk0LN/K2yMNd+TDsCbwVvqlvyyMEh6FyjY=; b=CViaV+AeErYTVEqYP8NPR/SrfGPYQQuJlVnJmIBGJ83OiOQlJyzXu3Z77ykP0lNjrxlNX3lw++AQtB7mwY9uJOlZwGikYOXX4SukIFLRqhUIRFaZuMjLjyW3wmlcsqNv8bSep5DQhl7diB88560qD7YHB9wTDKIC6N5E6sgYXfw= ARC-Authentication-Results: i=1; mx.zoho.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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1561639899666112.62484563065186; Thu, 27 Jun 2019 05:51:39 -0700 (PDT) Received: from localhost ([::1]:50444 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hgTsE-0000ip-Ca for importer@patchew.org; Thu, 27 Jun 2019 08:51:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53779) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hgTpa-0006yD-Jq for qemu-devel@nongnu.org; Thu, 27 Jun 2019 08:48:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hgTpT-0003iN-7n for qemu-devel@nongnu.org; Thu, 27 Jun 2019 08:48:50 -0400 Received: from mail-ot1-x341.google.com ([2607:f8b0:4864:20::341]:41729) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hgTpS-0003VB-Eg for qemu-devel@nongnu.org; Thu, 27 Jun 2019 08:48:42 -0400 Received: by mail-ot1-x341.google.com with SMTP id o101so1804089ota.8 for ; Thu, 27 Jun 2019 05:48:27 -0700 (PDT) Received: from serve.minyard.net (serve.minyard.net. [2001:470:b8f6:1b::1]) by smtp.gmail.com with ESMTPSA id t6sm703428otk.36.2019.06.27.05.48.25 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 27 Jun 2019 05:48:25 -0700 (PDT) Received: from t430.minyard.net (t430m.minyard.net [192.168.27.3]) by serve.minyard.net (Postfix) with ESMTPA id 858D21800CD; Thu, 27 Jun 2019 12:48:24 +0000 (UTC) Received: by t430.minyard.net (Postfix, from userid 1000) id 322BA302315; Thu, 27 Jun 2019 07:48:24 -0500 (CDT) 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=Mz9dF6CfjXk0LN/K2yMNd+TDsCbwVvqlvyyMEh6FyjY=; b=msWzvICk5j80hHbSqdIw289EZ1tX19kLPYhQUNfaCcmXmPOztCB4VMgbEQRtPXJg/j 1x2iOBDgAdJXZUUz2p4B5A64lkWZ5k4EWMWv9c1GxWpwBw6gPRAC9qJ+HZUYdCqSNBO3 50gmPKR7M9RfCQPFTRyNpD+eTa46VCe/4x3uqlZmmNy0t4P4y9TRHXiNu74El7/i2saZ xHbh0ebeTGPV4R+UrRsCXw0F9TcFRBT4eat+tQo184Z83jUVOzpkMto/uNfaDppHv/vh quBbCR9TUIM8Uihz/rb4IJOFp8Z/5+SHUsS9mCX5MuIh1dbJw9TFEDgT4zrz1ige88bd M2NQ== 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=Mz9dF6CfjXk0LN/K2yMNd+TDsCbwVvqlvyyMEh6FyjY=; b=ijk7h7cYl3Eha1W/9BLjmvCKQj5Je3EuXTsij8ozj3PUww7NQwXKDQnHmlTBdzILTc Kb5AwdpVwtFcbHJDLgJjR591+5oJDkKiM2kslWvN4EUOh9j/03JR0GZyCoqvkpsWOcNB p2jEopPjUfnyFEnhxIdcwWXzChevi5snzVxdvpbC/1wT6J5TzRrmRlruaLlc9E5s0Q0y belImUGpqHlyAPvwbgZWXa41RM04X5s06L/vStKeI72lYb7pbrjkJNP9YnLycda9YSuQ Qw44w4O2hvVbdA+IZ1QdQL63JQceSF41pgsuT4LQA7zeTaK1JpW80938JVhcIN9YTB4q mgYQ== X-Gm-Message-State: APjAAAWZBKRNShpkKBg3mDL8iiRAm1ZH5B8e5yJ2XIxrC4xcfd7uN4Yk Lk6dcXKTxYlLAgwxkGd02w== X-Google-Smtp-Source: APXvYqy09B3i+xYJ9zBuQMp1BfP2ey27Iujhn13Uryy8r2EcS8ylU8dYPCpoWOo00SCOZ8SU6G2ukQ== X-Received: by 2002:a05:6830:199:: with SMTP id q25mr560546ota.79.1561639706247; Thu, 27 Jun 2019 05:48:26 -0700 (PDT) From: minyard@acm.org To: Peter Maydell Date: Thu, 27 Jun 2019 07:48:15 -0500 Message-Id: <20190627124815.29536-3-minyard@acm.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190627124815.29536-1-minyard@acm.org> References: <20190627124815.29536-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::341 Subject: [Qemu-devel] [PULL 2/2] ipmi: Add a UUID device property X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Corey Minyard , "Michael S . Tsirkin" , QEMU Developers , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , 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 1980536517..007e2c6588 100644 --- a/hw/ipmi/ipmi_bmc_sim.c +++ b/hw/ipmi/ipmi_bmc_sim.c @@ -221,7 +221,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; @@ -937,8 +937,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 @@ -1980,12 +1991,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 @@ -2005,6 +2010,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 0d8beb4afd..ec56ab8f6f 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -700,7 +700,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 @@ -713,8 +713,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} @@ -723,6 +723,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