Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4564993rdb; Tue, 12 Dec 2023 03:20:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IHipjn6FAlw21NgxtWERTKAjeLR7qdAoFt4r0Zzj+3knIU6D6cfPT7sbFb+ybdx1flKJEaV X-Received: by 2002:a17:903:41cd:b0:1d0:b2d7:b1c1 with SMTP id u13-20020a17090341cd00b001d0b2d7b1c1mr7515021ple.8.1702380013137; Tue, 12 Dec 2023 03:20:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702380013; cv=none; d=google.com; s=arc-20160816; b=uXMMHEkFy70K93cHXmDfWnF3MWROVaLTvfxVHTc6rhwN3ASchwLybU3/b4CnI2fhO/ J+4tN6Ae4txFHKE/mkmvXCyXX4yENpJoXmLbRiYD76+vGh9QRsictKNdmDVRn4HhHPfw OJJ6tTqa6yP77WrhQlJ1+QNM0ojf7Xzb+LVcBDH/Y3HtigceH4rwgUxC5WhEMphxcmTQ TpQfb60mlLIWaOMKYRrJxUVGcz/ttvDxPNTvoAtBRbdyQ3nB0rhmBfPpUGrk0TwAuW7V ueccovOkIlNeDJto8bfisKIAALcMVBtJazL58OK0biiz46nXBjLPBcoSgC4NCT4H5hp+ augg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:autocrypt :from:references:cc:to:content-language:subject:user-agent :mime-version:date:message-id:dkim-signature; bh=vwEjDc2CrhhCQ4rSnFOIHTRLclNv351PRw1yqQ6gOvc=; fh=4IaJWlAyCTvRDvQk0RZeBxT+7Hw6n9moZNNQVTyikyc=; b=ljbJUOwJAXfG3jJbMCg7mmaNDFBoCwgCRb4Dzgyy8IQarAAY44RpeD98HewxjJQGED N1ytCujM4oBAFVatKhaM2ZcdpEMwoZjpfTgqhLrbvLv6xwNcF5Uspmr0iO5BWT72MmSY Srd/dgjvCylod8SBn3LI4MhiPfrY2V2frpFheV3kD5Vx4lVlj6AN2p212+impZUrmnh0 Vbyw3g25JbvGXfSAZWg3wPtAFCx39iLtucrI+YuncKmlAKrMcNMunKU5U6s0EG1Ng5zB OJQVuqis6gYv4AVOshyuWCR2qneh8ikeB/B7e21faLlSGes/xfNT5w6bPp2RV0ygM+Ft TeXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=google header.b=PPbWdpnT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id y8-20020a17090322c800b001d0b789d7c4si7841859plg.515.2023.12.12.03.20.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 03:20:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=google header.b=PPbWdpnT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 88BFC808EEEC; Tue, 12 Dec 2023 03:20:10 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346300AbjLLLTs (ORCPT + 99 others); Tue, 12 Dec 2023 06:19:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346201AbjLLLTr (ORCPT ); Tue, 12 Dec 2023 06:19:47 -0500 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FB2CD3 for ; Tue, 12 Dec 2023 03:19:53 -0800 (PST) Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-3332efd75c9so4967994f8f.2 for ; Tue, 12 Dec 2023 03:19:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1702379992; x=1702984792; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=vwEjDc2CrhhCQ4rSnFOIHTRLclNv351PRw1yqQ6gOvc=; b=PPbWdpnTsTIFgpHDHabpET4rPB4/PsPcM8tpxXMuQftJnzB4ogeNQSbHQIpX4izyGn s01KTJtMzWKxO2xjFwHXVi5ZFQvbEZjpaZgTznQ3kZwi9ix6muYZnxGr5RHiYyjSbqrq zoW0Iu7lNzpcSmc+c35mtIMRcrJHfdEYthQ6uM1soZQ4KztMibYgN/M/4gzh2kSFJb+h 7SPCON6fWgKxgYIS/H2Uq9w/2Lh2b0zmh33OT7dRYoh2vZ+ZtygKiu50PaJ3Nw/SBmLM GqYWkJTm3MnubDxp5JB4qOl1Sl/ThHQr3nYOiw3yfktGLIxiyEnRdHQ2SjIk0qHIIewu gyHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702379992; x=1702984792; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=vwEjDc2CrhhCQ4rSnFOIHTRLclNv351PRw1yqQ6gOvc=; b=RkRg+Xg+sNBb8bzqwyVbajPCdgj98LK1Gb7Yvsm6JoGS+qPgwfQG6HaP3iPrCgEu7F cqfUyihNMnJ7KWWLMA/bt623Hgsc8SB3oOBWEL3ei3cUXdLUaEQ7siX+SOre37QUd2QP AFQoELftFvsJtfpCp3eNRQbrfxI9YGUdVTsNLEa01Xciteru4b7SjBpXQvZ+YqikoiwI 1C9tiffOU0z5Pt70NJNoanqmaI5MK0v8CuJK+mkL803pe8Tx6wIsPYRYW+4Pt77PSKGv aLPGEkgbfMAWWrThbMBn+CyuOSsrBrEi3thPxVXHGZIj+hyJusLTlMco4ZSk0lkgBB9c PdOw== X-Gm-Message-State: AOJu0YxjHutDu5eNO+zNKWVBR6/xbIk4oeDoCWSMU0kFJ+svqxyjyZoP iw96XdyJKdY3ZxIIy1f9/FZt X-Received: by 2002:a05:6000:931:b0:333:3117:c48e with SMTP id cx17-20020a056000093100b003333117c48emr1212743wrb.287.1702379992016; Tue, 12 Dec 2023 03:19:52 -0800 (PST) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id w12-20020adfcd0c000000b003334010a849sm10541037wrm.109.2023.12.12.03.19.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 12 Dec 2023 03:19:51 -0800 (PST) Message-ID: Date: Tue, 12 Dec 2023 12:19:49 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC KERNEL PATCH v2 2/3] xen/pvh: Unmask irq for passthrough device in PVH dom0 Content-Language: en-US To: =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= Cc: "Chen, Jiqian" , Thomas Gleixner , Stefano Stabellini , Juergen Gross , Oleksandr Tyshchenko , Boris Ostrovsky , "Rafael J . Wysocki" , Len Brown , Bjorn Helgaas , "xen-devel@lists.xenproject.org" , "linux-kernel@vger.kernel.org" , "linux-acpi@vger.kernel.org" , "Stabellini, Stefano" , "Deucher, Alexander" , "Koenig, Christian" , "Hildebrand, Stewart" , "Ragiadakou, Xenia" , "Huang, Honglei1" , "Zhang, Julia" , "Huang, Ray" References: <15275706-5c31-4e29-aa29-9f5e90526219@suse.com> <50ca26a1-38e3-45fb-9c39-56e4d04de3e0@suse.com> From: Jan Beulich Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Tue, 12 Dec 2023 03:20:10 -0800 (PST) On 12.12.2023 12:18, Roger Pau Monné wrote: > On Tue, Dec 12, 2023 at 10:38:08AM +0100, Jan Beulich wrote: >> (I think the Cc list is too long here, but then I don't know who to >> keep and who to possibly drop.) >> >> On 12.12.2023 09:49, Roger Pau Monné wrote: >>> On Tue, Dec 12, 2023 at 06:16:43AM +0000, Chen, Jiqian wrote: >>>> On 2023/12/11 23:45, Roger Pau Monné wrote: >>>>> On Wed, Dec 06, 2023 at 06:07:26AM +0000, Chen, Jiqian wrote: >>>>>> +static int xen_pvh_setup_gsi(gsi_info_t *gsi_info) >>>>>> +{ >>>>>> + struct physdev_setup_gsi setup_gsi; >>>>>> + >>>>>> + setup_gsi.gsi = gsi_info->gsi; >>>>>> + setup_gsi.triggering = (gsi_info->trigger == ACPI_EDGE_SENSITIVE ? 0 : 1); >>>>>> + setup_gsi.polarity = (gsi_info->polarity == ACPI_ACTIVE_HIGH ? 0 : 1); >>>>>> + >>>>>> + return HYPERVISOR_physdev_op(PHYSDEVOP_setup_gsi, &setup_gsi); >>>>>> +} >>>>> >>>>> Hm, why not simply call pcibios_enable_device() from pciback? What >>>> pcibios_enable_device had been called when using cmd "xl pci-assignable-add sbdf" from pciback. But it didn't do map_pirq and setup_gsi. >>>> Because pcibios_enable_device-> pcibios_enable_irq-> __acpi_register_gsi(acpi_register_gsi_ioapic PVH specific) >>>>> you are doing here using the hypercalls is a backdoor into what's done >>>>> automatically by Xen on IO-APIC accesses by a PVH dom0. >>>> But the gsi didn't be unmasked, and vioapic_hwdom_map_gsi is never called. >>>> So, I think in pciback, if we can do what vioapic_hwdom_map_gsi does. >>>> >>> >>> I see, it does setup the IO-APIC pin but doesn't unmask it, that's >>> what I feared. >>> >>>>> It will be much more natural for the PVH dom0 model to simply use the >>>>> native way to configure and unmask the IO-APIC pin, and that would >>>>> correctly setup the triggering/polarity and bind it to dom0 without >>>>> requiring the usage of any hypercalls. >>>> Do you still prefer that I called unmask_irq in pcistub_init_device, as this v2 patch do? >>>> But Thomas Gleixner think it is not suitable to export unmask_irq. >>> >>> Yeah, that wasn't good. >>> >>>>> >>>>> Is that an issue since in that case the gsi will get mapped and bound >>>>> to dom0? >>>> Dom0 do map_pirq is to pass the check xc_domain_irq_permission()-> pirq_access_permitted(), >>> >>> Can we see about finding another way to fix this check? >>> >>> One option would be granting permissions over the IRQ in >>> PHYSDEVOP_setup_gsi? >> >> There's no domain available there, and imo it's also the wrong interface to >> possibly grant any permissions. > > Well, the domain is the caller. Granting permission to itself? Jan