From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f172.google.com (mail-qt1-f172.google.com [209.85.160.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EEBDE1AD3E5 for ; Tue, 13 Aug 2024 23:37:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723592248; cv=none; b=KUAcizPVlUt6FzLfSJJNYEuZn9DhfHbpS4sIY4E67d7PEOrECfhg1TaPZXdrYTgpF4RYMZltuM9nkjw2+v6Kcnle5Yw0VMOSFr6Osvu9E7FY/nt2agF6uGvkHKJfT1YaE/2R5js8iTGSxi/EkPgkSwWDb81W65WWpiFjz5hDKk4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723592248; c=relaxed/simple; bh=ZaeeD6EHcHKSJQeyzOBz7k5esMCWQ6i3pjcNxU7SD5M=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=BUFdQL1n3esSCNNr/cA3PUSHsaJ4dhGAqV7nRlAt3picsqqWzp+MksXtklkdLAPWLRHPrtiKVIliYo9FiWDYZa9TQcMMvX3978Dx76+Wg6Ww5YoNFFulchMiLC1y1HxxZXBjWR2IRE8NSLiK0XIWxlqDulFzSxDfSlQ2xslUVFI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca; spf=pass smtp.mailfrom=ziepe.ca; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b=nvi9UR4z; arc=none smtp.client-ip=209.85.160.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="nvi9UR4z" Received: by mail-qt1-f172.google.com with SMTP id d75a77b69052e-4519383592aso37484431cf.3 for ; Tue, 13 Aug 2024 16:37:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1723592246; x=1724197046; darn=lists.linux.dev; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=5VO2vOXTYUzHNGoqXkty4CZXSIWZNXE+mZa+Oe/5P5M=; b=nvi9UR4zSPYzbdQc7WquTPOqndcLogQ6o10ovF59IDuBsy3o/85lCqtQxLkaXld1e5 O/rM/bRJBeX0HqbdaOenDqEZ8BfDKfofn1UQIJPUGR5iOiPLAGuZIkMs6l0VpdnOyEnq BeXRIvEPllqhCf5t9ZINj+wF5V25TW9MbfvN2js1/zkTzWCPzZrmL7c+uextfO7yk3nt d+lTzHffVaTfKYwjkZTFdZLCVqzD4M23T/TgfHEY7XSUxIIvot/LtrVHeaqEta47DnVY J9fmpOXuvq3JmT5Ou3KE0mMnYVG4UXmDMnN8Jsz/FEp+3PcPT4ZTZusJzDPkA51NIp5o I+0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723592246; x=1724197046; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=5VO2vOXTYUzHNGoqXkty4CZXSIWZNXE+mZa+Oe/5P5M=; b=PwKtDyUraopvMqCP9QJu4tBZWBTpTtt5jZGyJbexHE/ky6SYkobrimtisLziY10R2i 1t2gypQGNe5haxuGsEF1wl7pGG9k/ZdhK61HPpLDk0yVB6Kn1fg3djrzVteGFnxxHiQg +ZSRYuLkRwSv5sqy+1KUXY0YQlTrdV3DeNFpFwNns09Qp3MdMsxhbAs0JEuYrNV0TIwM eqqKOv310/3SAcYdNOVgsDNn2XsVCley+V8PIahOG/5Nz4Z4LYBZLfFRd8LPwymEg3KO 0GiwMjo6q9ek8/UkU7+U0Ae8phTFetZWncftTkmhWo3NgYhExdY9Nsy14Kt4PU9XUf2N CR6A== X-Forwarded-Encrypted: i=1; AJvYcCWXloTsXSODQ4qIsfQnPgaxdjqzFVL+yK6BfdQMKyP9rpIwAR82ARxmjalWD9MUwv93i3e/9WknoIZHzozEUiup43I9FCE= X-Gm-Message-State: AOJu0Yzf3C8liyeVvS8mBdKuCPrcZjR3RcSlvJekeYySLKfdtJItWsfc LoYn44VyZjk8BfKSnwktyOQRSmT1sIEqCmKPOyBG4Rjocwy1IxhKvE3amL3EKP8= X-Google-Smtp-Source: AGHT+IFbm4qDYxgXzWa97F1Ax4tIokMkCTO/HLZVYUI3NA9l3rLq2ilxoJLGeZFzAszYUnI+b4y72g== X-Received: by 2002:a05:622a:5c17:b0:446:5c31:f268 with SMTP id d75a77b69052e-4535bb0821dmr11613701cf.30.1723592245902; Tue, 13 Aug 2024 16:37:25 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-142-68-80-239.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.68.80.239]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4531c26d30esm36041161cf.64.2024.08.13.16.37.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Aug 2024 16:37:25 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.95) (envelope-from ) id 1se14u-00AOBJ-NG; Tue, 13 Aug 2024 20:37:24 -0300 Date: Tue, 13 Aug 2024 20:37:24 -0300 From: Jason Gunthorpe To: Alex Williamson Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, quic_bqiang@quicinc.com, kvalo@kernel.org, prestwoj@gmail.com, linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, dwmw2@infradead.org, iommu@lists.linux.dev, kernel@quicinc.com, johannes@sipsolutions.net, jtornosm@redhat.com Subject: Re: [PATCH RFC/RFT] vfio/pci-quirks: Quirk for ath wireless Message-ID: <20240813233724.GS1985367@ziepe.ca> References: <20240812170045.1584000-1-alex.williamson@redhat.com> <20240813164341.GL1985367@ziepe.ca> <20240813150320.73df43d7.alex.williamson@redhat.com> Precedence: bulk X-Mailing-List: iommu@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240813150320.73df43d7.alex.williamson@redhat.com> On Tue, Aug 13, 2024 at 03:03:20PM -0600, Alex Williamson wrote: > How does the guest know to write a remappable vector format? How does > the guest know the host interrupt architecture? For example why would > an aarch64 guest program an MSI vector of 0xfee... if the host is x86? All excellent questions. Emulating real interrupt controllers in the VM is probably impossible in every scenario. But certainly x86 emulating x86 and ARM emulating ARM would be usefully achievable. hyperv did a neat thing where their remapping driver seems to make VMM traps and looks kind of like the VMM gives it the platform specific addr/data pair. It is a big ugly problem for sure, and we definately have painted ourselves into a corner where the OS has no idea if IMS techniques work properly or it is broken. :( :( But I think there may not be a terribly impossible path where at least the guest could be offered a, say, virtio-irq in addition to the existing platform controllers that would process IMS for it. > The idea of guest owning the physical MSI address space sounds great, > but is it practical? In many cases yes, it is, but more importantly it is the only sane way to support these IMS like techniques broadly since IMS is by definition not generally trappable. > Is it something that would be accomplished while > this device is still relevant? I don't know, I fear not. But it keeps coming up. Too many things don't work right with the trapping approach, including this. > The Windows driver is just programming the MSI capability to use 16 > vectors. We configure those vectors on the host at the time the > capability is written. Whereas the Linux driver is only using a single > vector and therefore writing the same MSI address and data at the > locations noted in the trace, the Windows driver is writing different > data values at different locations to make use of those vectors. This > note is simply describing that we can't directly write the physical > data value into the device, we need to determine which vector offset > the guest is using and provide the same offset from the host data > register value. I see, it seems to be assuming also that these extra interrupt sources are generating the same MSI message as the main MSI, not something else. That is more a SW quirk of Windows, I expect. I don't think Linux would do that.. This is probably the only way to approach this, trap and emulate the places in the device that program additional interrupt sources and do a full MSI-like flow to set them up in the kernel. Jason