From patchwork Mon Jul 1 18:30:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Corey Minyard X-Patchwork-Id: 11026991 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 C41F3112C for ; Tue, 2 Jul 2019 01:31:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ACA5D2876D for ; Tue, 2 Jul 2019 01:31:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D4E928845; Tue, 2 Jul 2019 01:31:50 +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=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AA6AA2876D for ; Tue, 2 Jul 2019 01:31:40 +0000 (UTC) Received: from localhost ([::1]:46878 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hi7e0-0002h3-2L for patchwork-qemu-devel@patchwork.kernel.org; Mon, 01 Jul 2019 21:31:40 -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) 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) 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) 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 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_Lureau?= , "Michael S . Tsirkin" 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 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 = 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 Mon Jul 1 18:31:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Corey Minyard X-Patchwork-Id: 11026953 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 DEA4F1398 for ; Tue, 2 Jul 2019 00:20:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CB510274D0 for ; Tue, 2 Jul 2019 00:20:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BE15827D16; Tue, 2 Jul 2019 00:20:54 +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=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 63497274D0 for ; Tue, 2 Jul 2019 00:20:48 +0000 (UTC) Received: from localhost ([::1]:46408 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hi6XP-0002or-1i for patchwork-qemu-devel@patchwork.kernel.org; Mon, 01 Jul 2019 20:20:47 -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) 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) 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) 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 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_Le_Goater?= , 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 Reviewed-by: Philippe Mathieu-Daudé --- 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; uint8_t acpi_power_state[2]; - uint8_t uuid[16]; + QemuUUID uuid; IPMISel sel; IPMISdr sdr; @@ -937,8 +937,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]); } } @@ -1980,12 +1991,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); @@ -2005,6 +2010,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 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}. 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 @@ -713,8 +713,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} @@ -723,6 +723,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}]