From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1o5RrP-0004xK-RM for mharc-qemu-trivial@gnu.org; Sun, 26 Jun 2022 08:59:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53002) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5RrO-0004ww-2v for qemu-trivial@nongnu.org; Sun, 26 Jun 2022 08:59:30 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:24836) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5RrK-0003a0-Bb for qemu-trivial@nongnu.org; Sun, 26 Jun 2022 08:59:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656248358; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=EWKAhxlYGU/zXw6dAaoTgwOVq0KRBRGkFCQdwQ8ZYEI=; b=VQX3ADfKIaLsdfWk8iJCQDb9S1p/8VFLZyhTq3ltm5LlD5klQUVawnQcsrSKxK5PeO5IMy RRsZVUgIAGoCMqnUe3sNDKV3Z2WNDd3PqAQRn57Odqi94djoE79oL8LHQFf4fnoWxpqR/O +8ksS9AiCWXr8BKApXC0/hfZu30DVZg= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-489-Bkz9S43bOGqJzHEaXpxtMw-1; Sun, 26 Jun 2022 08:59:17 -0400 X-MC-Unique: Bkz9S43bOGqJzHEaXpxtMw-1 Received: by mail-ed1-f70.google.com with SMTP id g8-20020a056402090800b00433940d207eso5295474edz.1 for ; Sun, 26 Jun 2022 05:59:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=EWKAhxlYGU/zXw6dAaoTgwOVq0KRBRGkFCQdwQ8ZYEI=; b=xy6AXFWotF/kmnbKng2GxX26FIukTDSfa5uiSIsBWtDR5D4qqq8xwvpk50Xi+JYKRa 1td9T+92cBIGqOKwRwWgylnjYIfN2gmW1NbKFW8dF5AvC2yp6zhC2lmmhlebYbZB3PWH FXZhaWPSaaxviveYVbYFidfJ/zThtwGf+uWa/rG1ybwX6RB2a2Pg5V9nL/P4cQhxLZNY 7LrapQmzBKEsEGeECWU+sl5cOjeLsG05oIHROc9GpZ28qk+nxwHPYXsA353bszHrltbF K4FRhGUjfdN2MGFd0k/DzpfX9HuUDpK8hhHzcl0DLGumGuSGqjo4a4CUhpXgh+PL3ELf NUCA== X-Gm-Message-State: AJIora8mqkHpDBFXMuUBBwdLXbW/kXgSwR7+gjuhcWyHdQL7RC9BPR69 9ADhwLh1oRmQleh/JX74Fl+9svN+uvjYDcmwQ1SsoX2GfQA7W0i38E6HOcg86bSX0lwPKBljfa4 tkvi7vIfEb/5CJ5Ki1w== X-Received: by 2002:a50:fc15:0:b0:435:7897:e8ab with SMTP id i21-20020a50fc15000000b004357897e8abmr10723592edr.17.1656248356507; Sun, 26 Jun 2022 05:59:16 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vWZ8v0/l6cE/oBqSOcuPEcSCQehWDW5ulN3bcCd4MSEDOnZY2sq6sSedgWnQ4Hs6d/v0G4yw== X-Received: by 2002:a50:fc15:0:b0:435:7897:e8ab with SMTP id i21-20020a50fc15000000b004357897e8abmr10723556edr.17.1656248356202; Sun, 26 Jun 2022 05:59:16 -0700 (PDT) Received: from redhat.com ([2.54.171.2]) by smtp.gmail.com with ESMTPSA id p24-20020a170906615800b00709343c0017sm3831548ejl.98.2022.06.26.05.59.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Jun 2022 05:59:15 -0700 (PDT) Date: Sun, 26 Jun 2022 08:59:11 -0400 From: "Michael S. Tsirkin" To: Bernhard Beschow Cc: qemu-devel@nongnu.org, Richard Henderson , xen-devel@lists.xenproject.org, qemu-trivial@nongnu.org, Eduardo Habkost , Marcel Apfelbaum , Stefano Stabellini , Paolo Bonzini , Anthony Perard , Paul Durrant Subject: Re: [PATCH 2/2] hw/i386/xen/xen-hvm: Inline xen_piix_pci_write_config_client() and remove it Message-ID: <20220626085903-mutt-send-email-mst@kernel.org> References: <20220626094656.15673-1-shentey@gmail.com> <20220626094656.15673-3-shentey@gmail.com> MIME-Version: 1.0 In-Reply-To: <20220626094656.15673-3-shentey@gmail.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-trivial@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jun 2022 12:59:30 -0000 On Sun, Jun 26, 2022 at 11:46:56AM +0200, Bernhard Beschow wrote: > xen_piix_pci_write_config_client() is implemented in the xen sub tree and > uses PIIX constants internally, thus creating a direct dependency on > PIIX. Now that xen_set_pci_link_route() is stubbable, the logic of > xen_piix_pci_write_config_client() can be moved to PIIX which resolves > the dependency. > > Signed-off-by: Bernhard Beschow Fine by me Acked-by: Michael S. Tsirkin > --- > hw/i386/xen/xen-hvm.c | 18 ------------------ > hw/isa/piix3.c | 15 ++++++++++++++- > include/hw/xen/xen.h | 1 - > stubs/xen-hw-stub.c | 4 ---- > 4 files changed, 14 insertions(+), 24 deletions(-) > > diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c > index 204fda7949..e4293d6d66 100644 > --- a/hw/i386/xen/xen-hvm.c > +++ b/hw/i386/xen/xen-hvm.c > @@ -15,7 +15,6 @@ > #include "hw/pci/pci.h" > #include "hw/pci/pci_host.h" > #include "hw/i386/pc.h" > -#include "hw/southbridge/piix.h" > #include "hw/irq.h" > #include "hw/hw.h" > #include "hw/i386/apic-msidef.h" > @@ -149,23 +148,6 @@ void xen_piix3_set_irq(void *opaque, int irq_num, int level) > irq_num & 3, level); > } > > -void xen_piix_pci_write_config_client(uint32_t address, uint32_t val, int len) > -{ > - int i; > - > - /* Scan for updates to PCI link routes (0x60-0x63). */ > - for (i = 0; i < len; i++) { > - uint8_t v = (val >> (8 * i)) & 0xff; > - if (v & 0x80) { > - v = 0; > - } > - v &= 0xf; > - if (((address + i) >= PIIX_PIRQCA) && ((address + i) <= PIIX_PIRQCD)) { > - xen_set_pci_link_route(address + i - PIIX_PIRQCA, v); > - } > - } > -} > - > int xen_set_pci_link_route(uint8_t link, uint8_t irq) > { > return xendevicemodel_set_pci_link_route(xen_dmod, xen_domid, link, irq); > diff --git a/hw/isa/piix3.c b/hw/isa/piix3.c > index 6388558f92..48f9ab1096 100644 > --- a/hw/isa/piix3.c > +++ b/hw/isa/piix3.c > @@ -138,7 +138,20 @@ static void piix3_write_config(PCIDevice *dev, > static void piix3_write_config_xen(PCIDevice *dev, > uint32_t address, uint32_t val, int len) > { > - xen_piix_pci_write_config_client(address, val, len); > + int i; > + > + /* Scan for updates to PCI link routes (0x60-0x63). */ > + for (i = 0; i < len; i++) { > + uint8_t v = (val >> (8 * i)) & 0xff; > + if (v & 0x80) { > + v = 0; > + } > + v &= 0xf; > + if (((address + i) >= PIIX_PIRQCA) && ((address + i) <= PIIX_PIRQCD)) { > + xen_set_pci_link_route(address + i - PIIX_PIRQCA, v); > + } > + } > + > piix3_write_config(dev, address, val, len); > } > > diff --git a/include/hw/xen/xen.h b/include/hw/xen/xen.h > index 13bffaef53..afdf9c436a 100644 > --- a/include/hw/xen/xen.h > +++ b/include/hw/xen/xen.h > @@ -23,7 +23,6 @@ extern bool xen_domid_restrict; > int xen_pci_slot_get_pirq(PCIDevice *pci_dev, int irq_num); > int xen_set_pci_link_route(uint8_t link, uint8_t irq); > void xen_piix3_set_irq(void *opaque, int irq_num, int level); > -void xen_piix_pci_write_config_client(uint32_t address, uint32_t val, int len); > void xen_hvm_inject_msi(uint64_t addr, uint32_t data); > int xen_is_pirq_msi(uint32_t msi_data); > > diff --git a/stubs/xen-hw-stub.c b/stubs/xen-hw-stub.c > index 743967623f..34a22f2ad7 100644 > --- a/stubs/xen-hw-stub.c > +++ b/stubs/xen-hw-stub.c > @@ -19,10 +19,6 @@ void xen_piix3_set_irq(void *opaque, int irq_num, int level) > { > } > > -void xen_piix_pci_write_config_client(uint32_t address, uint32_t val, int len) > -{ > -} > - > int xen_set_pci_link_route(uint8_t link, uint8_t irq) > { > return -1; > -- > 2.36.1