Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp109114imm; Mon, 1 Oct 2018 07:24:59 -0700 (PDT) X-Google-Smtp-Source: ACcGV61b6jMLFqGSDpqzYcdYvjKm4xpKi0gL9tlRGWLgY0ijj3BntHEv0zAq6zv+qqcnzzDZKLMG X-Received: by 2002:a62:1655:: with SMTP id 82-v6mr11722283pfw.11.1538403899267; Mon, 01 Oct 2018 07:24:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538403899; cv=none; d=google.com; s=arc-20160816; b=jXglvG/Ac/RTSGmoYJp64rDtvfcpAOXEPYRFIaAi3BN+cGyAPnvMZ04rXnw5YB+rIq EXB5WOUBQbGWPk8STKtcPr43HFb4Aon9bIHs/VkRT5r3wrWkonMs+dE59yyJbCdKEA2h O3YVzZs0jsx4ArO+22i18/vRQB+N6ABNrP24PASBitgh8+Eu3A7J2jbu+gmK9vrRDcuo UyPQbkZ06phBIyfuzKPmdmp2TjREWEAnwpFNbdDniOsDGYexYI/XKq8JmxRJvQR+C7yI bFTnXgWkvILUGBIYXQb6Z+uGWj2BLr5JbFHKXVwbZmTw7X4fnvNzgC5bUyMmn/yHLAlL JwAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:cc:to:subject; bh=62T0HD3vqJrhWdjLDa3FB5J9aDdBLGiPBp4Vd0WG6RM=; b=vFh4JNfQQOPQxP/gNHAZ5YYP1B7f+qfF6C+5mEVtnfXJVgBwF3F2IPZU19v5uIBCHs e7eZw333BYZatptE/L5hc1oCcjdi5i7X9u4mcAAnC8ieOus53afVjoz2V1Gj29BxoZAV hE5eR3BpuQgGjgR0Za3NEpmefFmul0kkW5lqTO9iUEU21YSdl/Vt538blq7GForulXkh M+m+qLm5PiZVkvYqAm4gK0ehGtSTk4pmisnTdJju9GMR3akVNYfFZ7j8HOx1naU0c4lc 4BQhSfD76V12qUKXNMv2ktt17xQDsgA9qQCWDdsXyqxTfLrnc1elx56DP0TJSg4UOw8C d3ZQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i61-v6si9826855plb.193.2018.10.01.07.24.43; Mon, 01 Oct 2018 07:24:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729462AbeJAVCe (ORCPT + 99 others); Mon, 1 Oct 2018 17:02:34 -0400 Received: from serv1.kernkonzept.com ([88.99.87.17]:52079 "EHLO mx.kernkonzept.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728979AbeJAVCd (ORCPT ); Mon, 1 Oct 2018 17:02:33 -0400 Received: from ip5f5b9406.dynamic.kabel-deutschland.de ([95.91.148.6] helo=localhost.localdomain) by mx.kernkonzept.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) id 1g6z7b-0008OM-Mq; Mon, 01 Oct 2018 16:24:27 +0200 Subject: Re: x86/apic: MSI address malformed for "flat" driver To: Thomas Gleixner , Cyril Novikov Cc: linux-kernel@vger.kernel.org References: <27bccfd2-0ede-cd3a-2717-741d3dffebdf@lynx.com> From: Philipp Eppelt Openpgp: preference=signencrypt Autocrypt: addr=philipp.eppelt@kernkonzept.com; prefer-encrypt=mutual; keydata= xsFNBFd+Tn8BEACov93RkQG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fW5GdoFQerzFGr6TX7BuHHm9RIsrzMs/IhEKZVI2aoWlrmF9tj3U9meqsB dCUAEQEAAcLBZQQYAQgADwUCV35OfwIbDAUJB4TOAAAKCRCDy52RMrDsISbbEACM8a6Q4sVC cW2OGeIuEwedWK76kcwM0PZNGHyPon0R1S5SklkDz4Itt6vnOk2feeu8MErSUuSBKAGgrjNx PPYZGq9HZ4HUoVwHPwHKzr7wnFvfIIKXHRs+N0tFm9mWXfFturvuhNXTtUQDM44FEnachu8s hx0D+k1Wv9NIE1QAQE0w5scXy2RMq2Cdp4FaQzkp7mcF/Fwlt6LNqhAly4zrYby6Z3eY/gBG Lsmvvj7fVxhsKIJEvROfHEUYyQJ7WZ1c5SpGWMWvjOwzWh4YH21FkcEpDur35V649amOcfVF 3c+A5E31sSnVOGb393NxGN9bWPaVhAp7C7l22P6M0q4bCY6IEjEULR9xFNT/P7+UturI7qag UgjAhoQ2Z101DDZpy/829x9swByk3VaViBrRICnNVUHSp0Vxroxg01aaW+Q4vqqbTuyWClXd rXwuP2mZdtR4/uUSTGxVyte7As7hDBEFir7louqGvh4yMzmXcVZ4NPWVnPHMMRe7J+eqjPQN xLFwzryjJIBhjqfgxE3xWqky9MxDRh4T5zAe49DIAQpqyWW9i4Nu369DX2V5IrLC++Lfkawk ArmL3zoHgJqo7M3l2Y69wIV/Jz2f0s/WO6EDU226VIvflkAmAPxy5aEmjKSyoMNf4+bmOlXs khuLCBwcsLPhxbjZ6s1AXffYGA== Message-ID: Date: Mon, 1 Oct 2018 16:24:27 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/11/2018 02:29 PM, Thomas Gleixner wrote: > On Mon, 10 Sep 2018, Cyril Novikov wrote: >> On 9/7/2018 12:11 PM, Thomas Gleixner wrote: >>> On Thu, 6 Sep 2018, Philipp Eppelt wrote: >>>> >>>> The "flat" driver defines the MSI addressing scheme to be used as >>>> logical addressing in flat mode. The MSI msg address is composed >>>> accordingly, but sets MSI_ADDR_REDIRECTION_CPU which is a zero at bit[3]. >>> >>> Correct. That's what it means: >>> >>> * When RH is 0, the interrupt is directed to the processor listed in the >>> Destination ID field. >>> >>> So for DM: >>> >>> * If RH is 0, then the DM bit is ignored and the message is sent ahead >>> independent of whether the physical or logical destination mode is >>> used. >>> >>> which is means that the delivery does not do any magic redirections, >>> because the Redirection Hint is off. If RH is set, then the delivery can >>> redirect according to the rules in the DM section. We are not using that >>> because we want targeted single CPU delivery. >>> >>> The interpretation of the DID field is purely depending on the local APIC >>> itself by matching the APIC ID against the DID field. And the local APIC ID >>> of CPU0 is 1 << 0, i.e. 0x1 which matches the MSI message you see. >> >> I believe you are wrong here and the local APIC ID of CPU0 is 0. >> >> processor : 0 >> vendor_id : GenuineIntel >> ... >> physical id : 0 >> siblings : 8 >> core id : 0 >> cpu cores : 4 >> apicid : 0 >> >> The fact that the code works means that DM is not ignored when RH is 0. In >> other words, RH=0 DM=1 means logical destination mode. > > Sorry, I did not explain it very well. Let me try again. > > * If RH is 0, then the DM bit is ignored and the message is sent ahead > independent of whether the physical or logical destination mode is > used. > > The PCI device simply writes the message data to that address, it does not > even know what the individual bits mean. It's a write of data to address. > > The write gets then directed to the APIC bus or the Processor System Bus > depending on the CPU by a translation unit. Ah, so there is a translation unit right before the apic/system bus which translates the MSI address & data to the system bus format. I missed that bit in the manual. I assumed a connection between RH and DM when the APIC interprets the message. > If RH is not set then the logic translates the message without > modifications including the DM bit. Albeit RH=0 the DM bit IS interpreted by the local APIC at the end as the DM bit is part of the system bus message format? Can you point me to some documentation on the translated message format? I guess it is similar to the local APIC's Interrupt Command Register? > > Hope that clarifies it. Yes, thank you very much for the additional explanations. > > Out of curiosity: What kind of problem are you trying to solve? I am in the process of writing a x86_64 VMM for the L4Re OS with Linux as a guest and are working on the PCI subsystem/MSI handling of the VMM for virtual devices. Cheers, Philipp