From patchwork Thu Feb 16 18:32:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: ben@skyportsystems.com X-Patchwork-Id: 9578053 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D116F60244 for ; Thu, 16 Feb 2017 18:33:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C476D284D1 for ; Thu, 16 Feb 2017 18:33:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B91922863C; Thu, 16 Feb 2017 18:33:20 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 1F068284D1 for ; Thu, 16 Feb 2017 18:33:19 +0000 (UTC) Received: from localhost ([::1]:49376 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceQrm-00077y-Ke for patchwork-qemu-devel@patchwork.kernel.org; Thu, 16 Feb 2017 13:33:18 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45111) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceQrS-00077f-DS for qemu-devel@nongnu.org; Thu, 16 Feb 2017 13:32:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ceQrP-0004Ag-9X for qemu-devel@nongnu.org; Thu, 16 Feb 2017 13:32:58 -0500 Received: from mail-pg0-x22d.google.com ([2607:f8b0:400e:c05::22d]:33225) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ceQrP-0004Aa-0x for qemu-devel@nongnu.org; Thu, 16 Feb 2017 13:32:55 -0500 Received: by mail-pg0-x22d.google.com with SMTP id y6so4613072pgy.0 for ; Thu, 16 Feb 2017 10:32:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=skyportsystems.com; s=google; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=BNPHMBPF2LF2AzNLt1MXXXQ4xffeIKbZJ2Iitidv27A=; b=hYmfbwpVmCBV6gUEYXUFkt0SV7nT9uBJbYb+oN0cISLZYg8XJSCJDSc9ZjdVg9ZSjA 4XkDbpPjl6YNJYh4eew24RwxwYJy5Ki9W/JPKUXR/faNd7TJ4i96J4IHpBsmKs5ZnpzM i9xFiWM/rX3DqD/zo4PXAKKiNu6VPXJkWFdTw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=BNPHMBPF2LF2AzNLt1MXXXQ4xffeIKbZJ2Iitidv27A=; b=QO6DDBwuNVeH9n2tUjfNXvQCCwHb3GCF/9ec/0JQM5NpahOPQHm6Of2kJTYfBpsxS4 zSgGh16g255DFnujAskApiquVF2FSnZEsAkuTFxQv4FIPHYU33jE5dIJSjgZCFASVS5j If7X4KhDW23WZMMQ7gCC+3/3WOoV1jhoZIGzHnHoC32PK8dYjCcf2kLE9yJS8f5oxCx/ 22f3gWdx5AyuGN1fisd9gnyCDZM1fU+Pn8wEF/noTeraH+gBFC5StqwIoLml8RhXDEnE k6A+KC5VModZgLp9PlfoMqXVX7oi7sZ39HF5cktfEpkItP9ekuN4Tw33lGDlMlRPkWv+ ZHDg== X-Gm-Message-State: AMke39nwRt9+ODYsahXYbitD1G+AaCQb3hxyqw1s/23NvWLcgZrayc8MIICx1H33SMwaZIlJ X-Received: by 10.99.175.93 with SMTP id s29mr1215894pgo.30.1487269973880; Thu, 16 Feb 2017 10:32:53 -0800 (PST) Received: from [10.10.243.190] (67-207-112-138.static.wiline.com. [67.207.112.138]) by smtp.gmail.com with ESMTPSA id w89sm14898253pfk.133.2017.02.16.10.32.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Feb 2017 10:32:53 -0800 (PST) From: Ben Warren Message-Id: <41F19D95-ED58-427E-944A-00F872F8DD48@skyportsystems.com> Mime-Version: 1.0 (Mac OS X Mail 10.2 \(3259\)) Date: Thu, 16 Feb 2017 10:32:52 -0800 In-Reply-To: <20170216105649.43944bad@nial.brq.redhat.com> To: Igor Mammedov References: <625570854359178b416000644f68695bc50630ae.1487224954.git.ben@skyportsystems.com> <20170216105649.43944bad@nial.brq.redhat.com> X-Mailer: Apple Mail (2.3259) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c05::22d Subject: Re: [Qemu-devel] [PATCH v7 4/8] ACPI: Add Virtual Machine Generation ID support 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: lersek@redhat.com, qemu-devel@nongnu.org, mst@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP > On Feb 16, 2017, at 1:56 AM, Igor Mammedov wrote: > > On Wed, 15 Feb 2017 22:18:14 -0800 > ben@skyportsystems.com wrote: > >> From: Ben Warren >> >> This implements the VM Generation ID feature by passing a 128-bit >> GUID to the guest via a fw_cfg blob. >> Any time the GUID changes, an ACPI notify event is sent to the guest >> >> The user interface is a simple device with one parameter: >> - guid (string, must be "auto" or in UUID format >> xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) >> >> Signed-off-by: Ben Warren > Reviewed-by: Igor Mammedov > > Thing to get fixed on top is to check > that there isn't vmgenid device present already > into realizefn() and fail gracefully is there is. > I made the change as follows: Sample output: $ ../workspace/qemu/x86_64-softmmu/qemu-system-x86_64 -nographic -bios ../workspace/seabios/out/bios.bin -machine type=q35 -hda beiwe-with-vmgenid-driver.qcow2 -qmp unix:./qmp-sock,server,nowait -device vmgenid,guid="324e6eaf-d1d1-4bf6-bf41-b9bb6c91fb66" -device vmgenid,guid="324e6eaf-d1d1-4bf6-bf41-b9bb6c91fb67" qemu-system-x86_64: -device vmgenid,guid=324e6eaf-d1d1-4bf6-bf41-b9bb6c91fb67: Device vmgenid may only be specified once Good enough? If so, I’ll roll it in. Otherwise, it’ll be a supplemental patch. —Ben === diff --git a/hw/acpi/vmgenid.c b/hw/acpi/vmgenid.c index c8465df..fa3de6d 100644 --- a/hw/acpi/vmgenid.c +++ b/hw/acpi/vmgenid.c @@ -207,8 +207,15 @@ static void vmgenid_handle_reset(void *opaque) static void vmgenid_realize(DeviceState *dev, Error **errp) { + static bool is_realized = false; VmGenIdState *vms = VMGENID(dev); + + if (is_realized) { + error_setg(errp, "Device %s may only be specified once", + VMGENID_DEVICE); + } qemu_register_reset(vmgenid_handle_reset, vms); + is_realized = true; } ===