From patchwork Thu Nov 8 14:19:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Corey Minyard X-Patchwork-Id: 10674343 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 26C1915E9 for ; Thu, 8 Nov 2018 14:21:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 152992DC5D for ; Thu, 8 Nov 2018 14:21:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1087E2DB93; Thu, 8 Nov 2018 14:21:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9AE2B2DC6F for ; Thu, 8 Nov 2018 14:21:13 +0000 (UTC) Received: from localhost ([::1]:57055 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gKlBI-0005CW-LD for patchwork-qemu-devel@patchwork.kernel.org; Thu, 08 Nov 2018 09:21:12 -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) 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) 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) 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 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_Le_Goater?= , =?utf-8?q?Marc-Andr=C3=A9?= =?utf-8?q?_Lureau?= , Paolo Bonzini , David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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é 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 = true, \ } +#define DEFINE_PROP_UUID_NODEFAULT(_name, _state, _field) { \ + .name = (_name), \ + .info = &qdev_prop_uuid, \ + .offset = offsetof(_state, _field) \ + + type_check(QemuUUID, typeof_field(_state, _field)), \ + } + #define DEFINE_PROP_END_OF_LIST() \ {} From patchwork Thu Nov 8 14:19:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Corey Minyard X-Patchwork-Id: 10674345 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C66F015E9 for ; Thu, 8 Nov 2018 14:21:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B00242DC43 for ; Thu, 8 Nov 2018 14:21:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AD6082DCA9; Thu, 8 Nov 2018 14:21:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 64CE42DBE1 for ; Thu, 8 Nov 2018 14:21:31 +0000 (UTC) Received: from localhost ([::1]:57058 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gKlBa-0005Ki-Ld for patchwork-qemu-devel@patchwork.kernel.org; Thu, 08 Nov 2018 09:21:30 -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) 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) 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) 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 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_Le_Goater?= , =?utf-8?q?Marc-Andr=C3=A9?= =?utf-8?q?_Lureau?= , Paolo Bonzini , David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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édric 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; uint8_t acpi_power_state[2]; - uint8_t uuid[16]; + QemuUUID uuid; IPMISel sel; IPMISdr sdr; @@ -936,8 +936,19 @@ static void get_device_guid(IPMIBmcSim *ibs, { unsigned int i; + /* An uninitialized uuid is all zeros, use that to know if it is set. */ for (i = 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 = 0; i < 16; i++) { + rsp_buffer_push(rsp, ibs->uuid.data[i]); } } @@ -1979,12 +1990,6 @@ static void ipmi_sim_realize(DeviceState *dev, Error **errp) ibs->acpi_power_state[0] = 0; ibs->acpi_power_state[1] = 0; - 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); @@ -2004,6 +2009,7 @@ static Property ipmi_sim_properties[] = { 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(), }; 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}. Some drivers are: -@item -device ipmi-bmc-sim,id=@var{id}[,slave_addr=@var{val}][,sdrfile=@var{file}][,furareasize=@var{val}][,furdatafile=@var{file}] +@item -device ipmi-bmc-sim,id=@var{id}[,slave_addr=@var{val}][,sdrfile=@var{file}][,furareasize=@var{val}][,furdatafile=@var{file}][,guid=@var{uuid}] 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. @table @option -@item bmc=@var{id} -The BMC to connect to, one of ipmi-bmc-sim or ipmi-bmc-extern above. +@item id=@var{id} +The BMC id for interfaces to use this device. @item slave_addr=@var{val} Define slave address to use for the BMC. The default is 0x20. @item sdrfile=@var{file} @@ -493,6 +493,10 @@ file containing raw Sensor Data Records (SDR) data. The default is none. size of a Field Replaceable Unit (FRU) area. The default is 1024. @item frudatafile=@var{file} file containing raw Field Replaceable Unit (FRU) inventory data. The default is none. +@item guid=@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 @item -device ipmi-bmc-extern,id=@var{id},chardev=@var{id}[,slave_addr=@var{val}]