Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4520742rdb; Tue, 12 Dec 2023 01:38:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IFu4VADrm43zLQ5zngelIU+i0ACyUL5aijVA/WhPfcSTTN05skjGLpGDhw0AgYnIP+l2nf8 X-Received: by 2002:a05:6870:70a4:b0:1fa:f2a4:f3fa with SMTP id v36-20020a05687070a400b001faf2a4f3famr7120865oae.12.1702373923722; Tue, 12 Dec 2023 01:38:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702373923; cv=none; d=google.com; s=arc-20160816; b=LRA+ifcTCBNMF7+VPQtXldOf2hzZQu19zeCSz6HjZhf7FuiRyQTnWQ2kxE8ucOAPZs wti20wlkeY9jRE4Mvu2BfqtT0K4J3UQ0i8Q61p13WRWL04kLkjKkXLg1MDnchd2KRkAR imDjCayjnNhkTBr7bbkYf90IHK8cOmzQhnGfBLNWdBTN1zPgbDTqD92micz8DRvoowSk z1IT7XO1k69M9mOdSZrlBuWpjfTWQPhrnYuDhjRVmfkMVtWVCBMKvA8yQAs/FDx3Ieqe Lm1JMbcenLnwUukXAsOrTugKPYs83ND5DGYLq9rCKxykxCOQL9GRG6XNvHP10KK2lhKB 836g== 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=eYVZtZhSR1Rq0Lag/6BK768XzJ3pRiFsk9NAFdAubjk=; fh=w8mkkYMY4lmgsM7xxdvWATbf+cp3xytHaCxbysCZIAs=; b=S3kSjxB7q7JyxRa5/pyK3kr3OxO8iPt/TEOXplhyJepOn9FhMR6PxEogco4aR7qbYD G5LoUsQPaaJE1kL9XGBxBhnGyPXILIN82DbNPKqf6gzbRR96BQmbCrwRjo+xcA+RQbA4 myLp5pAxZoHn7l5MZktFecuElWWVXUZQmsdd7tdXHBC+p0N/9jYsACuegUlzH/lxv2dQ hFrZsuqRfh8+dby1HuyF5eeBOTFMtw6uOAmOQNvrc0j8YQCgJ2T7rXievHh7d0+yWPq/ T5mKVML5fE3ZF78CoGeKKPYQrsWita7Fy91qb1gbo5yN6TM7dYYD3ayrFqzwHnruv4zX C7fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=google header.b=cDivgVMv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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. [23.128.96.38]) by mx.google.com with ESMTPS id h10-20020a65518a000000b005c1cc9caf0asi7533722pgq.899.2023.12.12.01.38.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 01:38:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=google header.b=cDivgVMv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 E9F7680A1364; Tue, 12 Dec 2023 01:38:40 -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 S229966AbjLLJi0 (ORCPT + 99 others); Tue, 12 Dec 2023 04:38:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229489AbjLLJiY (ORCPT ); Tue, 12 Dec 2023 04:38:24 -0500 Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36AFBCE for ; Tue, 12 Dec 2023 01:38:30 -0800 (PST) Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-2ca0f21e48cso69826001fa.2 for ; Tue, 12 Dec 2023 01:38:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1702373908; x=1702978708; 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=eYVZtZhSR1Rq0Lag/6BK768XzJ3pRiFsk9NAFdAubjk=; b=cDivgVMvNctsiXvchGBt0TKMB649s+qlIMrCtDmBtq3pRx4aKeE7/7UT6It/HkKyvn ZMhZs6jBPuf7k91JMTLwtjvh2IeDT0Z5fJu48LD1FA8Lor1APdfZrSG0S3oZQ1c/ahQ1 sEMevREZR3eMMIv+I6eso/q8unahcMHxSGNuViYgsc3fwakxX+pE0WA2RI3mA1FCfdzD ZcvcPyA/6HARM4tl0dYVcaChPOxbhe9s9C1wdxLxfuc5inQMbuBhb21/f/SEElHQRywZ NrA7PdX2fp5+1R/cWqwXxRrhxlHMTJ7ntx0Ey+7U74jAi2fJ/slz4jBSSbzIudqfKL58 aLlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702373908; x=1702978708; 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=eYVZtZhSR1Rq0Lag/6BK768XzJ3pRiFsk9NAFdAubjk=; b=vSZiwgY4EFkzP8v40iltQryeM9d+e9xrRI4x1zxPD1VLVGbnqN8mIFMjoOAs3QDSYJ 4I0CkdaFE6LnJKbAi6+tF5eGtGxy9eaYYN55ADWys7p9OQ5FUIzQsxVVi9M67LNaHM12 pMlo+LNJvtnanjERLa+/kIuoXaS9fyuZ0qqxg8x92XmNq3hcq9MVtkgnvEgLzzgrIg+A mvJb9Xd65Kw93wuDjLgF5jIzH4x/Tz4+LTw9v/BIP6787xJcIFhFKa3ciNUFeSFfQE5N 304WLP5ZNQABlt7ZoTUNVwmGjzXJRFJ1WfaIstkEqeyBkKsHF1bjG3C/pGObdS4ikOGF hGuw== X-Gm-Message-State: AOJu0YzTc1SekjzSBy+X/oS8r3YN89riP4Ud2s4Tbm9/XQQNNu9hm0le FstzfzACRCyBT4Flb232zKxm X-Received: by 2002:a2e:86d8:0:b0:2ca:cb6:f478 with SMTP id n24-20020a2e86d8000000b002ca0cb6f478mr2618844ljj.52.1702373908388; Tue, 12 Dec 2023 01:38:28 -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 l39-20020a05600c1d2700b0040c2c5f5844sm15927874wms.21.2023.12.12.01.38.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 12 Dec 2023 01:38:28 -0800 (PST) Message-ID: <50ca26a1-38e3-45fb-9c39-56e4d04de3e0@suse.com> Date: Tue, 12 Dec 2023 10:38:08 +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?= , "Chen, Jiqian" Cc: 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> 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 01:38:41 -0800 (PST) (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. > Otherwise we could see about modifying the logic in PHYSDEVOP_map_pirq > so that the hardware domain can map IRQs to other domains without > having it mapped to itself first? While this may be possible to arrange for, it still would feel wrong. How would you express the same in a disaggregated environment? I.e. how would you make sure a domain trying to grant permission is actually permitted to do so for the resource in question? > I think the call to PHYSDEVOP_setup_gsi in pciback is fine, but I > would really like to avoid the usage of PHYSDEVOP_{,un}map_pirq on a > PVH dom0 against itself. +1 Jan