From patchwork Wed May 22 18:10:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Druzhinin X-Patchwork-Id: 10956439 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 16505112C for ; Wed, 22 May 2019 18:12:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 091511FF28 for ; Wed, 22 May 2019 18:12:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F19601FF30; Wed, 22 May 2019 18:12:22 +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.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 706861FF3E for ; Wed, 22 May 2019 18:12:22 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hTVhK-0006q3-Nx; Wed, 22 May 2019 18:10:42 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hTVhJ-0006py-Eh for xen-devel@lists.xenproject.org; Wed, 22 May 2019 18:10:41 +0000 X-Inumbo-ID: e7bed797-7cbc-11e9-8980-bc764e045a96 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id e7bed797-7cbc-11e9-8980-bc764e045a96; Wed, 22 May 2019 18:10:39 +0000 (UTC) Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=igor.druzhinin@citrix.com; spf=Pass smtp.mailfrom=igor.druzhinin@citrix.com; spf=None smtp.helo=postmaster@MIAPEX02MSOL02.citrite.net Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of igor.druzhinin@citrix.com) identity=pra; client-ip=23.29.105.83; receiver=esa1.hc3370-68.iphmx.com; envelope-from="igor.druzhinin@citrix.com"; x-sender="igor.druzhinin@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa1.hc3370-68.iphmx.com: domain of igor.druzhinin@citrix.com designates 23.29.105.83 as permitted sender) identity=mailfrom; client-ip=23.29.105.83; receiver=esa1.hc3370-68.iphmx.com; envelope-from="igor.druzhinin@citrix.com"; x-sender="igor.druzhinin@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:23.29.105.83 ip4:162.221.156.83 ~all" Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@MIAPEX02MSOL02.citrite.net) identity=helo; client-ip=23.29.105.83; receiver=esa1.hc3370-68.iphmx.com; envelope-from="igor.druzhinin@citrix.com"; x-sender="postmaster@MIAPEX02MSOL02.citrite.net"; x-conformance=sidf_compatible IronPort-SDR: 10a1X91dTv4sCxhQ9Zkez7gVF7HgXlQ9bnUXdNZCEHjXZ2PwZxEA4A8MfGPLD91/AeFXmJgJBZ Vil+QCiXppb5ZdXGK02sCaJi88PtLfJG4K7nqo2MrcBCtsvonOKiVjst8zEuLADngwRYXjNw8E Ot+dIjP0iVtS+RsrAbKO94/MdKQCoZScy8OAzVW432LqzDYYO9GJLqXDeNrauy8ZxXua/BxBz/ DWxaZZ0kiB17l2If67kbMxzmH/5ZesfrW6bj1ViRohLLhOwt6TKOLLkngsfHKhG4wy7ZfMss4y JrI= X-SBRS: 2.7 X-MesageID: 786454 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 23.29.105.83 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.60,500,1549947600"; d="scan'208";a="786454" From: Igor Druzhinin To: Date: Wed, 22 May 2019 19:10:34 +0100 Message-ID: <1558548634-25154-1-git-send-email-igor.druzhinin@citrix.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH] libacpi: report PCI slots as enabled only for hotpluggable devices X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: andrew.cooper3@citrix.com, wei.liu2@citrix.com, ian.jackson@eu.citrix.com, jbeulich@suse.com, Igor Druzhinin Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP DSDT for qemu-xen lacks _STA method of PCI slot object. If _STA method doesn't exist then the slot is assumed to be always present and active which in conjunction with _EJ0 method makes every device ejectable for an OS even if it's not the case. qemu-kvm is able to dynamically add _EJ0 method only to those slots that either have hotpluggable devices or free for PCI passthrough. As Xen lacks this capability we cannot use their way. qemu-xen-traditional DSDT has _STA method which only reports that the slot is present if there is a PCI devices hotplugged there. This is done through querying of its PCI hotplug controller. qemu-xen has similar capability that reports if device is "hotpluggable or absent" which we can use to achieve the same result. Signed-off-by: Igor Druzhinin Reviewed-by: Jan Beulich --- tools/libacpi/mk_dsdt.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/libacpi/mk_dsdt.c b/tools/libacpi/mk_dsdt.c index 2daf32c..c5ba4c0 100644 --- a/tools/libacpi/mk_dsdt.c +++ b/tools/libacpi/mk_dsdt.c @@ -439,9 +439,10 @@ int main(int argc, char **argv) pop_block(); } } else { - stmt("OperationRegion", "SEJ, SystemIO, 0xae08, 0x04"); + stmt("OperationRegion", "SEJ, SystemIO, 0xae08, 0x08"); push_block("Field", "SEJ, DWordAcc, NoLock, WriteAsZeros"); indent(); printf("B0EJ, 32,\n"); + indent(); printf("B0RM, 32,\n"); pop_block(); /* hotplug_slot */ @@ -452,6 +453,12 @@ int main(int argc, char **argv) stmt("Store", "%#010x, B0EJ", 1 << slot); } pop_block(); stmt("Name", "_SUN, %i", slot); + push_block("Method", "_STA, 0"); { + push_block("If", "And(B0RM, ShiftLeft(1, %i))", slot); + stmt("Return", "0xF"); + pop_block(); + stmt("Return", "0x0"); + } pop_block(); } pop_block(); } }