From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AB449C433EF for ; Sun, 26 Jun 2022 13:01:29 +0000 (UTC) Received: from localhost ([::1]:46026 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5RtI-0005l7-6q for qemu-devel@archiver.kernel.org; Sun, 26 Jun 2022 09:01:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53004) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5RrN-0004wx-Uu for qemu-devel@nongnu.org; Sun, 26 Jun 2022 08:59:30 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:28702) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5RrK-0003a2-Bi for qemu-devel@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=1656248359; 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=dGagiqUTsheALfqqEJQJZUQg9Y84U31IsYHFPUSxbkOTf9pM+Usqz59c38fuY0OXegSnoF qIuFzAxIw+xlYwXp5ypBNtzT9ykFVdW4k8ZAqMfV5Gc4Wi93qITXZgPei0hhW4OSwRVffp 0Puzx09wssmxCXf7DI4Oo5TIwzia8iQ= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-487-WWSs68TAMl2b8VIIWbzDxg-1; Sun, 26 Jun 2022 08:59:17 -0400 X-MC-Unique: WWSs68TAMl2b8VIIWbzDxg-1 Received: by mail-ed1-f72.google.com with SMTP id x21-20020a05640226d500b00435bd7f9367so5269637edd.8 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=oLIy655/GMsRELN3hQ1v7jcs0TH8A1jehokjtwO62xnia6XhPphxt13zUVPeX58A8g wBvYaytC6BUEEg1pCyp5+hV3mwik1KYuLYGrFtGLM/VsluJWIZfGGPk9S6H85kqWrw3l dncCKZA9EEePcbKaj6HoIW27KymQTFIq9L5VVfSIOim3RuWXHTGKwqtmMEmCmXLualxP 8pFVMEFQ2XqxMXAT/14eC/L6R7wuxmEchg0fYIkIeGXMjKN35X+rgsAinM62SDe4R1/S 7d609vRCsUKwIb2fBBPBm4q5G0qcB/hpfNXiLPJ9fDc7IPT0OLDcyzgi0vAE1C6sGryT KIYg== X-Gm-Message-State: AJIora8Hfk73C/MKbW9g01G1p7FC4uYuvBXK1+HmTw5JbKOq5LTdroEl Bk7rsHKFUibPd+nmoJSzZQcZr0DD/xiMOjVegArVot3RI0odK9DMz9dLU3LXE7013XIAJwpfmu2 hR92iRnL1+o6/tKA= X-Received: by 2002:a50:fc15:0:b0:435:7897:e8ab with SMTP id i21-20020a50fc15000000b004357897e8abmr10723585edr.17.1656248356432; 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 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220626094656.15673-3-shentey@gmail.com> 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=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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