Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B5F62606A32C for ; Thu, 3 Dec 2026 14:08:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.a=rsa-sha256 header.s=google header.b=Vsss/Gxf Received: from list by lists.xenproject.org with outflank-mailman.1512525.1704593 (Exim 4.92) (envelope-from ) id 1xZ7TT-00039b-4Q; Thu, 03 Dec 2026 14:07:51 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 1512525.1704593; Thu, 03 Dec 2026 14:07:51 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xZ7TT-00039A-1J; Thu, 03 Dec 2026 14:07:51 +0000 Received: by outflank-mailman (input) for mailman id 1512525; Thu, 03 Dec 2026 14:07:49 +0000 Received: from mx.expurgate.net ([194.145.224.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xZ7TR-000354-G6 for xen-devel@lists.xenproject.org; Thu, 03 Dec 2026 14:07:49 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1xZ7TQ-00GJUm-Ke for xen-devel@lists.xenproject.org; Thu, 03 Dec 2026 15:07:48 +0100 Received: from [10.42.69.4] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6b1177b0-e002-0a2a0a5209dd-0a2a4504d286-16 for ; Thu, 03 Dec 2026 15:07:48 +0100 Received: from [209.85.128.51] (helo=mail-wm1-f51.google.com) by tlsNG-ebf023.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6b1177b4-b57f-0a2a45040019-d1558033d9f7-3 for ; Thu, 03 Dec 2026 15:07:48 +0100 Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-4bb64ef5a00so114702615e9.3 for ; Thu, 03 Dec 2026 06:07:48 -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 ffacd0b85a97d-4ab6baa397asm84479659f8f.48.2026.12.03.06.07.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Dec 2026 06:07:47 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Post: List-Help: List-Subscribe: , Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=suse.com header.i="@suse.com" header.h="Content-Transfer-Encoding:Content-Type:In-Reply-To:Autocrypt:From:Content-Language:References:Cc:To:Subject:User-Agent:MIME-Version:Date:Message-ID" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1796306868; x=1796911668; darn=lists.xenproject.org; h=content-transfer-encoding:content-type:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=E8jBvc9diC/aO7DVPloN66KVOMqN47HiaO1wpAqrrvY=; b=Vsss/Gxfy3b6A0GAMpHITwwSmHs1CUWF7Nukf1XLZBZ5TJsdGWiSLW8DFd12jgnUwz NnlhrH6rL4OKGFBh5TIKua3QH6niHkztmztouPzBVpNZeOrok7hCKb6jJcmBQP87i5H4 cOENzZSRdKIRhxuXU66KtNWogLii9f3sLAcl/9PAx3bhk/6MeV2C/MeJnaqHPL/4X2do DOpLkQsOTo3DaQ+YDWR90gVsEfgZi0hQHGDWiE2AGFN/fVZrWNCAPOhGUL/aZqCZMupI YYUVlg4RhW+jQBi0jVc93KUqsmDuZCaORY8AiIp6uihmQ2Dg1GcRLkzACzCrBjdGeWLT haZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796306868; x=1796911668; h=content-transfer-encoding:content-type:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=E8jBvc9diC/aO7DVPloN66KVOMqN47HiaO1wpAqrrvY=; b=NoPzPmhDREWfguZlxu6Q2v9tTTHLgYZqFa6JVAqeglQGruUkaR0VAeIWIyPl3V3pnq wwJBAClNHD1Ss7Z6Urj46oxiXcUiPS3m32Z3eLL2EQboJxtBdFGCfAePC1k0utJMeRpC u75CYTw/jpFHoGPdYDhgx5Q48cxPIWTMqTasp8k0h6putGHb3Absg3KQ2vDB/FaEpsqF rcwZhZsXUuQRrbjbl6F8n82xOW1w6OWBV1H87pF3AcYbI1Az3UHjW1zuZV4qXcl2e4q0 tUPk74keD6vsopgVdw511CCZ3uKfFxUG0erzAD5iM+ujoGgtwggdH3XhD+TpWexMpkrG aTww== X-Forwarded-Encrypted: i=1; AL+hErE0ZxIZ5Nd2Y5pK/KHpbVgviJLrY7v3rJn1qi1f5l8KOVw2CdaQoBOiWQFzdwCeZu1VYDdk/KGruJ0=@lists.xenproject.org X-Gm-Message-State: APuU4Z/3GtVQprH0vgXrc/DKzkHq5E1ebdWfviIS2DvQC+FRzrlvxajC x38BOWvRK2UGjIdAVw8Vh30TSSWdsLcTXKz2XM3Z1ve84cJmYw3sB18je+Jj5Qlg5Q== X-Gm-Gg: AZFdTZciZu+rCLiAimSEzew9UOL4gIlthk2Kh38NQvp58TYtNY6EMEJHYUW/hWKOvD0 b/m1vo9Al/SBGL9kg0SWyoceCanLX6X3j4x/e2K0ze2S8AuTIQV47F5bf5S8KPbncMB59yHEkfw 5y6/Ff6cw9iEpftQJqgnilEeHnlulipJHUJGE+N5YkIn4/Lt/uutnevxjiGgiGKdKlxyu4rOwQg zYhWRZiUPMR6lg0fVSuX8BZqveNtsHw2ROM335wzFl/570+WDEhq3u9ajPnFPNlsnL1V3aAedNC r8ZHgSFF5+AOLfYbrO2HX91LdAihDqetqwPkbNcaFMKh1FcUzP0NTtHAo5+decBYb9UJB80YDBW vizGkd193AvGx43/O1W5LojL1ERekrj9bFDo/w8L1ECUn8EfxoNQzdgtJmhkqrGF+aR5WO/ik6R Xz8MzLDNQy+AHDlwHZXYKWoB33V1vjkqX1CODJqwZFjG0CHS6/xG1wSqc6zpAZy3vjRxF8raWYn cYyd3VwGKeOkrIHY0F95eQ4a/dTlMY60OebudLULjS/gEEJARsiTWOJbcnHZ4YSqVuYTk94nGkz jeaf2y4zZ+Zm2BGgBkkzngRIvtppi+2lzuzgeVa64DKTL+rjO3B1YpIF2THVrXtDouRue8zmMlA vmwKONArOMTgJRk0= X-Received: by 2002:a05:600c:4e48:b0:4bb:c507:3d74 with SMTP id 5b1f17b1804b1-4bbc5073e19mr219602345e9.30.1796306867826; Thu, 03 Dec 2026 06:07:47 -0800 (PST) Message-ID: <62c63672-91e6-46b5-923a-01fdb404f6d6@suse.com> Date: Thu, 3 Dec 2026 15:07:46 +0100 X-Archived-By: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3] xen/amd/iommu: record the IOMMU and device flags for alias DeviceIDs To: Stefano Stabellini Cc: andrew.cooper3@citrix.com, roger@xenproject.org, jason.andryuk@amd.com, teddy.astie@vates.tech, xen-devel@lists.xenproject.org References: <20261026235926.2105578-1-stefano.stabellini@amd.com> <20261027201425.2405102-1-stefano.stabellini@amd.com> Content-Language: en-US From: Jan Beulich Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE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MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <20261027201425.2405102-1-stefano.stabellini@amd.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-purgate-ID: tlsNG-ebf023/1796306868-522D4B50-7584A95E/0/0 X-purgate-type: clean X-purgate-size: 2350 X-Spam-Status: No, score=-12.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS, UNPARSEABLE_RELAY,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On 27.10.2026 21:14, Stefano Stabellini wrote: > add_ivrs_mapping_entry() marks an alias DeviceID valid and may give it > an interrupt remapping table, but records the IOMMU and the IVHD device > flags only for the device using the alias. If no IVHD entry names the > alias DeviceID itself, amd_iommu_setup_device_table() passes a NULL > IOMMU to amd_iommu_set_intremap_table(), which dereferences it at boot, > and the alias's DTE, the one applying to requests using the alias, is > set up without the device's pass-through and SysMgt settings. > > Give the alias the IOMMU and the device flags too, as was done before > the interrupt remapping rework, and as Linux does. > > Fixes: a3713b97e8e1 ("AMD IOMMU: Rework of interrupt remapping") > Signed-off-by: Stefano Stabellini > --- > On v2, Jan asked about: > > - amd_iommu_alloc_intremap_table(): not reached for the alias, which > already has a table when interrupt remapping is on. When it's off, > amd_iommu_set_intremap_table() doesn't use the IOMMU. > > - find_iommu_for_device(): before, an unnamed alias crashed at boot > with interrupt remapping on. With it off, a device at the alias > failed to be added (-ENODEV), or got function 0's entry copied over > the alias's, losing its unity maps. It now returns the alias's > IOMMU, and an IVMD naming the alias is applied instead of ignored. > > - amd_iommu_get_reserved_device_memory(): the alias is no longer > skipped. For XENMEM_RDM_ALL its ranges are reported once under it, > not once per device using it. > > - Earlier vs later entries: later entries still win, so an alias entry > can now override the device flags of an earlier entry for the alias > itself. The alias's IOMMU is asserted to match, as suggested. > > - Other fields: device_flags is now set for the alias. The rest are > either the alias's own or already recorded for it; block_ats is > never set by alias entries, so using the alias's is OK. I don't understand this last part: I think it is a problem that block_ats is never set for aliases. Taking amd_iommu_setup_domain_device() as example, its (2nd) use of get_dma_requestor_id() may yield the alias ID. Then the subsequent use_ats() may return true when the real BDF entry hase .block_ats set. Jan