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: 150526 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp878349ljp; Thu, 8 Nov 2018 06:20:43 -0800 (PST) X-Google-Smtp-Source: AJdET5eDaWCQ0wE93HyNQW/sEp1QnuW0W1+hDT5LoNlzkLwBwF3HLk7bFVLmm8tj8vrcpNOXbdTL X-Received: by 2002:a0c:80e7:: with SMTP id 94mr4460638qvb.97.1541686843141; Thu, 08 Nov 2018 06:20:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541686843; cv=none; d=google.com; s=arc-20160816; b=ic7z7QE08CV4Ur5QoSSVfKkv9XtNIfImn2wPbToC9lYX04hf/a1S+iSU/bmwd9NpHS 8p8DBYlOHoKdHETQYgFhcEoQCWv1sKHmPBXW7F41pM8jCU1pYU34ps/FwJvBBp7e70aV 7o2ilBSfhrBGJ2Oogv9DvrXaRwml+V3ltgK1enAW9o0/mrBQRM0zPdTEXvB4ciQuLNLv wQj9ExaR1uHAvg+INDkFYyACmQd5sRBMth0DESk/yd2L0xpPZ9ixETGBiwZ+/r4zM12Z eV1ToDQR7P1b2HLBc/rExIrFqkQ0jSmPPNpad9ORWokFXWp2kd7HGLUykChGD7WpaTic sw3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=AP6xD02RFFacHTqEUqShMxIasfMNNWi7Dq9ljJglfnE=; b=TZDT6Tl/5X8dRGJcPTHRhiQN2S6w/y4yNEhxrkXWdRBJbQ0mA9kQfoamQm/6bjuTsS VAtWCOsnEeyLjXONdAAQ/BgWFgVOkl8I1AWWHQg1cyEEzwMEStGLZifmYUX1vSRyH4q5 W+QNoRBeQxCBiyEWr4uTldw5ckqzTbQMt5hjE8NPZ7yqbDCgC1cDM7GEn4kyGmHKK94Y XW32SDCco+6Fv8vWxRcLyEAzSKmlwVSMKaDimU5zDusQAG7xhwBlSlG64ADA6pVcsqjF WVATfg/aR/RvEyrI0M2Iqr6wjmJPYnJuiPCCZvrQG3lbscY0puzYJigNqIatxC0dAwDg HZeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=uuUgvATI; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id p2si3013090qtq.4.2018.11.08.06.20.42 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 08 Nov 2018 06:20:43 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=uuUgvATI; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:57053 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gKlAo-0004km-KW for patch@linaro.org; Thu, 08 Nov 2018 09:20:42 -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-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_Goat?= =?utf-8?q?er?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Paolo Bonzini , David Gibson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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(-) -- 2.17.1 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}]