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.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 4C7C3CEDD89 for ; Wed, 9 Oct 2024 12:10:08 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.814437.1227993 (Exim 4.92) (envelope-from ) id 1syVVa-0007CB-8V; Wed, 09 Oct 2024 12:09:38 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 814437.1227993; Wed, 09 Oct 2024 12:09:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1syVVa-0007C4-5p; Wed, 09 Oct 2024 12:09:38 +0000 Received: by outflank-mailman (input) for mailman id 814437; Wed, 09 Oct 2024 12:09:36 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1syVVY-0007By-QN for xen-devel@lists.xenproject.org; Wed, 09 Oct 2024 12:09:36 +0000 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [2a00:1450:4864:20::634]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 59883449-8637-11ef-a0bd-8be0dac302b0; Wed, 09 Oct 2024 14:09:35 +0200 (CEST) Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-a9953bdc341so454363666b.2 for ; Wed, 09 Oct 2024 05:09:35 -0700 (PDT) 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 a640c23a62f3a-a992e7e226bsm648053366b.210.2024.10.09.05.09.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 09 Oct 2024 05:09:34 -0700 (PDT) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 59883449-8637-11ef-a0bd-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1728475775; x=1729080575; darn=lists.xenproject.org; h=content-transfer-encoding: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; bh=LcSk0hKhTZvm1b8dZbnCjCU2ZKbnfk0LnD76zfyF5I8=; b=gGwyR85r3kp+sAlQfajS/31ScktlR0rUOgeavlwYEdGkabfEG6e6mnWgUL6UozfrDs WCF4NCBxrdF7I7P1DbvQZtzACZRDFPuSGgdGPw8iwOGviVn4nv47AsQ+Qpb0e17H0htn gKOHmjq54kpWrQXgWBjPAKfewy0bkoTXctZoOowXtK2UD8ROM4YkiOqwvdQEmWthPKfF v+m6xuNz2RyA87UXpK13flTnFSXCl3kNkLT4PtIhI1hfY4QPYT1eP3W0NIF15VKfqGNZ KmpSHqI8jyw3Q6+SnJz6367ycUyAKitpT3ZfJ4mrziulR6W0b9TASVXiqARargtG3kjT Nl6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728475775; x=1729080575; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=LcSk0hKhTZvm1b8dZbnCjCU2ZKbnfk0LnD76zfyF5I8=; b=iiNQzgXDNMiH/ho9thsiP4xJuHWwu352r5WKDMF/WBmjy60uL//JR+GP4hBmoE57jv Yejf9ke7PUV9k+QOJYN0jJNvWX94Qpxbx2GP7xUeFNd6Tge/64Vgm+V1LAhSVNrpMord N/ov4g1pE69LZOPSuyTOIxOcjKAq7N0sJpxRIGay7P1c6DaYx4NbeWTl3VLTRNsaqayj Yevutehbc9nJpXJzcPG4m8VVUIPcIKFCDu1G7oAI94RFswTU9Wu3n0jWmc1boNBxEEBP UHgGrZYxvagOh/vquJxnM8vzjaiqauvOeiXVj9pd/eTKeaEUGnUHfZm+sBICFvroIjd8 pNyA== X-Forwarded-Encrypted: i=1; AJvYcCVQSqd4E/h81zILPf+Ek/OnmMVUgH1AthvtOZlBKuWSm4UgrLonKy4I/FGKADGUUtEoSh9u37YCm0c=@lists.xenproject.org X-Gm-Message-State: AOJu0YyyBlxOvWsBvz9uSDpKvRoGAMYoRdjH9NN6OAjaS5W37MEvwadH P9VL01xQ7QkHIUR4jiM4LuYp4dxGopCVHFVkSSd6++Gdxcu/JEkDiFpGDGuh3Q== X-Google-Smtp-Source: AGHT+IFde4xi1BocKAe01aSiw3Kd16/2Vf/qL1o2fHlH94NUNTWGZT+em5sefsz9xl6RdJ3Qb69xrg== X-Received: by 2002:a17:907:e2e7:b0:a99:371e:7a91 with SMTP id a640c23a62f3a-a998d32585cmr177373666b.52.1728475774955; Wed, 09 Oct 2024 05:09:34 -0700 (PDT) Message-ID: <34f73ec6-0e10-41f4-8894-c367264afefc@suse.com> Date: Wed, 9 Oct 2024 14:09:33 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] iommu/amd-vi: do not error if device referenced in IVMD is not behind any IOMMU To: =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= Cc: Andrew Cooper , Willi Junga , xen-devel@lists.xenproject.org References: <20241008104706.74001-1-roger.pau@citrix.com> <5a2a4ff4-a2c7-46f6-bd18-a4837fe8d4c1@suse.com> <703fa416-c7d5-4862-a871-5831125c2e25@suse.com> Content-Language: en-US From: Jan Beulich Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBAD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P7AAMFB/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 On 09.10.2024 13:47, Roger Pau Monné wrote: > On Wed, Oct 09, 2024 at 01:28:19PM +0200, Jan Beulich wrote: >> On 09.10.2024 13:13, Roger Pau Monné wrote: >>> I also think returning an error when no device in the IVMD range is >>> covered by an IOMMU is dubious. Xen will already print warning >>> messages about such firmware inconsistencies, but refusing to boot is >>> too strict. >> >> I disagree. We shouldn't enable DMA remapping in such an event. Whereas > > I'm not sure I understand why you would go as far as refusing to > enable DMA remapping. How is a IVMD block having references to some > devices not assigned to any IOMMU different to all devices referenced > not assigned to any IOMMU? We should deal with both in the same > way. Precisely because of ... > If all devices in the IVMD block are not covered by an IOMMU, the > IVMD block is useless. ... this. We simply can't judge whether such a useless block really was meant to cover something. If it was, we're hosed. Or maybe we screwed up and wrongly conclude it's useless. > But there's nothing for Xen to action, due to > the devices not having an IOMMU assigned. IOW: it would be the same > as booting natively without parsing the IVRS in the first place. Not really, no. Not parsing IVRS means not turning on any IOMMU. We then know we can't pass through any devices. We can't assess the security of passing through devices (as far as it's under our control) if we enable the IOMMU in perhaps a flawed way. A formally valid IVMD we can't make sense of is imo no different from a formally invalid IVMD, for which we would return ENODEV as well (and hence fail to enable the IOMMU). Whereas what you're suggesting is, if I take it further, to basically ignore (almost) all errors in table parsing, and enable the IOMMU(s) in a best effort manner, no matter whether that leads to a functional (let alone secure [to the degree possible]) system. What I don't really understand is why you want to relax our checking beyond what's necessary for the one issue at hand. >> the "refusing to boot" is interrupt remapping related iirc, if x2APIC >> is already enabled. We need to properly separate the two (and the >> discussion there was started quite a long time ago, but it got stuck at >> some point); until such time it is simply an undesirable side effect of >> the inappropriate implementation that in certain case we fail boot when >> we shouldn't. > > Yes, but that's a different topic, and not something I plan to fix as > the scope of this patch :). Sure, I'm merely asking to accept that, until that's resolved, issues with boot failure can result here, and need to be lived with. Jan