From nobody Fri May 10 05:56:26 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=1562031175; cv=none; d=zoho.com; s=zohoarc; b=LZZ3DlPO/DFKqKxCdU4qMQLryhAL1msfYIh0gkPWJqKfGsCruYilQFtb2tLxjscXSx4lwQlywDLL5vUd7T47wNCYTDypmTXXoABsbYrW/2Gdpnm1MD/r4QbMBF/k//XhaUAQa6gBw+UQ7ihBh1LvMX0xZlkwrcF7cGvpn9Yph2k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1562031175; 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=jAZewyWtqqnR9/Jn6xzxrnQofrNtuzXqpjOKdOFbDQpXhuR0jC6YU4+i2etzZXnzVagfNaQqvIPYGKbt4Zu9FAb2fPq7FV3CrzEtsJYhjpwwmJ8gXeR4TJ0AoMVreexdKQr+R4+U3Yi43hzR+C4i4/Qn6hjbqsutt/Puu2suibI= 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 1562031175159210.5388437493492; Mon, 1 Jul 2019 18:32:55 -0700 (PDT) Received: from localhost ([::1]:46878 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hi7fC-0002h3-7r for importer@patchew.org; Mon, 01 Jul 2019 21:32:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46459) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hi3vE-0007mx-7Y for qemu-devel@nongnu.org; Mon, 01 Jul 2019 17:33:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hi3uy-0001cD-2m for qemu-devel@nongnu.org; Mon, 01 Jul 2019 17:33:02 -0400 Received: from mail-ot1-f67.google.com ([209.85.210.67]:46131) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hi3ur-0001ZY-JI for qemu-devel@nongnu.org; Mon, 01 Jul 2019 17:32:52 -0400 Received: by mail-ot1-f67.google.com with SMTP id z23so14988585ote.13 for ; Mon, 01 Jul 2019 14:32:43 -0700 (PDT) Received: from serve.minyard.net ([47.184.134.43]) by smtp.gmail.com with ESMTPSA id r25sm4088223otp.22.2019.07.01.11.31.08 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 01 Jul 2019 11:31:08 -0700 (PDT) Received: from t430.minyard.net (unknown [IPv6:2001:470:b8f6:1b:9997:a955:13ad:73b]) by serve.minyard.net (Postfix) with ESMTPA id 9B7BC1805A7; Mon, 1 Jul 2019 18:31:07 +0000 (UTC) Received: by t430.minyard.net (Postfix, from userid 1000) id 69795302524; Mon, 1 Jul 2019 13:31:07 -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=tq/6aN5DApde1qD0uiyz4tCJKoQdHyCm2ka4GFRo7Zdhy/CtMjJ7RRmrLsNY8c57Iv KEnqRmJCVoV9Jkxqe8jwZEFAx0H6Kck9+l37/pd7wJ8Xd59foClWR+X99WzVEtI3cpgm 7sbfRM4fyEt8PQzshIcR66iYrrETIYAPnN1LD+EG/ySEvW9gp9KTMegmBwuHSs+4iMKo jRIOMOVcNc3UUczMd7M/SytLCpEzuj6Ytq7H9SoMfIeZriS8BX9pUrXs54jm2or5ZcG0 5xiG5UM/ryLVFEf1Z8b4OFPEFB/B5PsXRbIIDo1wG2uoaPNn+pLiQ7pgjZyXZ1LoFd9Z d5GQ== 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=p3kfrfNUb94JsVAyWx7O0JIqPXf3ksXhu1P0xEW/SG8mShhwyWvBJp7decaHppCRkL 14KPETtwmT9Z6l2j+vpUH1QNe8PG0tvhqCQo8k8uxOGRNUW2TVhAP5PddSLz8wASrb7h 4f2EECYdmeWTJ2qTze813QwyIl0yR+cRcvj1vZSMs8KpW3QO763I58lgWZifTK0XQpgW tl8g/ctyY5ngKqk3HVzqZ7RBNplvTHZ8XNXmcvbbxcTLZS9cXw26SGR5W+ktPbc8gsTK JLggk1qxEKsvHm7eDT9IktZawpD96QGk3pMlyVdbCtiXo6fcGpqoSy7sFdNGkOX115D+ QvgA== X-Gm-Message-State: APjAAAU2/iToaI5QHzmAOmNlBTDP4j5a9tSpO0YSR5b9pQefZ+LDzRuo LnBhTRP/KFtIvmLAI1kQsI4y2Ns= X-Google-Smtp-Source: APXvYqxeYgzwvL3CtC7Kr5Gy0G8bIVrz8yCcgE1J9SJ5A7b9w/PMkHPgUJ5XjJC5FTFrSS+TKm/e8Q== X-Received: by 2002:a05:6830:14c:: with SMTP id j12mr20372450otp.181.1562005870918; Mon, 01 Jul 2019 11:31:10 -0700 (PDT) From: minyard@acm.org To: QEMU Developers Date: Mon, 1 Jul 2019 13:30:59 -0500 Message-Id: <20190701183100.7849-2-minyard@acm.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190701183100.7849-1-minyard@acm.org> References: <20190701183100.7849-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: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.210.67 Subject: [Qemu-devel] [PATCH v2 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 , =?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 May 10 05:56:26 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=1562026990; cv=none; d=zoho.com; s=zohoarc; b=WN/JN8l7ltS8bBekVsNW16wnWcd9fZj7F77HqV1QMo+AyKFoyc3a+7ZQjALjf0zWwrV5ZJ9nytLvLIRoN8x+q+yW0tifPzGs6faCF37YEy3j53ftZ1EMpF8DaVfoQyFfWDZF/PWOeJ8crmj63dfyPTURmKPbwBq1FZpPYq9muag= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1562026990; 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=jUoivGMK+IUE5dosy5LwhZLeOB1uB9mCUDACWFY9VkZOA9n3GhpOjKto20YSmCOwZ50Rs3w1x8sf9lVklgFUf/bCQu7E+xvXdt6dwERH3tlDjAljB87FDgMKvfhsd3F6rZDR3sstJrICyU/vRiMxpiqXwXf+C8nLnj8MPWd0aVU= 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 1562026990096908.369922235655; Mon, 1 Jul 2019 17:23:10 -0700 (PDT) Received: from localhost ([::1]:46408 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hi6ZZ-0002or-Ij for importer@patchew.org; Mon, 01 Jul 2019 20:23:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35337) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hi3ds-000560-WB for qemu-devel@nongnu.org; Mon, 01 Jul 2019 17:15:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hi3dn-0002Ai-IT for qemu-devel@nongnu.org; Mon, 01 Jul 2019 17:15:16 -0400 Received: from mail-ot1-f66.google.com ([209.85.210.66]:32770) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hi3dn-0001q6-As for qemu-devel@nongnu.org; Mon, 01 Jul 2019 17:15:11 -0400 Received: by mail-ot1-f66.google.com with SMTP id q20so14962770otl.0 for ; Mon, 01 Jul 2019 14:14:45 -0700 (PDT) Received: from serve.minyard.net (serve.minyard.net. [2001:470:b8f6:1b::1]) by smtp.gmail.com with ESMTPSA id c125sm4156119oif.17.2019.07.01.11.31.08 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 01 Jul 2019 11:31:08 -0700 (PDT) Received: from t430.minyard.net (t430m.minyard.net [192.168.27.3]) by serve.minyard.net (Postfix) with ESMTPA id 95E931805A6; Mon, 1 Jul 2019 18:31:07 +0000 (UTC) Received: by t430.minyard.net (Postfix, from userid 1000) id 3C75D30042A; Mon, 1 Jul 2019 13:31:07 -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=CuMfXgPLIQxe5LbD9NopP9IMfzlWQHNUwWCF8lqXABbVS8OCOB65WxodTmu0DDeuuG yRuvQ8trdoOCtwJ36ll67Q/NA8fk17bVmtZPZtb+dpozdD/KZu1Hz14KBq3BatcV8vn4 wvra4BniHI5lbjSrAMoo4+iGei2vuwePKbqF13eSL9LVLLG/IkVYgvttqEdN7gq8ha1J 8rw0rX+nGyPnReTRKv3gARhuS/q2gta0ASJgklx6A1Rc0fQdzHLtpLhb0m4pdMfmrwa0 0Y1EnDa8EXcnVbJaqc63ZwUjZgMyxuwBcAahsYY8TNkwQhLrAz7aqF0D1Y/KbyuxNqI6 dFZw== 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=hKHh+3mmQo/35I6wYq57LuYdO+8Biz4xIGQQYOsyOyFyKXHO1S2Mcgw+1edprs1LPl yLrE3s4Cvz90p+XwgiK6j2emcP75VaNdzOs2afxp92rdqSURi6aJbqnjwfJRVL9O41B0 eua4XdM2B0Adm0os6CfgW77kJKsQhJCSEJYjW144xvVVzjs58lcIBUbPgm+m6ZW+x/Ms oyXvrg+Lr19PgSW8LSKmE+jrAAy+U0xOYq125njn41XZFNPcRnjy/wP8SdYgKh7sZ/xa /uwGD6ctJOISYzmG/GWUgThZ4RV2wu9e38Kj7xnyPeTYQJvyYFtJCMFil9YWJ5o2yNuG SXvw== X-Gm-Message-State: APjAAAWRrimvQyJOJg8nNIP52gQQLT8gzioBUWXdmNiamm5bSOzRb2/9 hOQ0qGORb5BXwot+Zan9A1GbqeE= X-Google-Smtp-Source: APXvYqzA3YsccTz0nuz686jNu2Y0yWUIswAm7N/FzK5qrTA5YvwU/z3U/fazon0ln4G6iF1B/Jc6mw== X-Received: by 2002:a9d:4546:: with SMTP id p6mr21625423oti.34.1562005869827; Mon, 01 Jul 2019 11:31:09 -0700 (PDT) From: minyard@acm.org To: QEMU Developers Date: Mon, 1 Jul 2019 13:31:00 -0500 Message-Id: <20190701183100.7849-3-minyard@acm.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190701183100.7849-1-minyard@acm.org> References: <20190701183100.7849-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: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.210.66 Subject: [Qemu-devel] [PATCH v2 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" , =?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 Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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