From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from sender4-of-o54.zoho.com (sender4-of-o54.zoho.com [136.143.188.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3B52233B97A; Wed, 29 Apr 2026 09:58:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.54 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777456720; cv=pass; b=tE45KAtOouU5jV6zg71L5ALzewoa4iuKTMxnoq3JgAXsMg4cWSoUStrNymMMOcG7J9D40KQtVl5hl7aQE83YszGiqXo6jGPeSeme7c4arokzG2xHH7QBOPCXmt+2FN3xpaWYTkB0VjXfKvcnQbX+Q5hwPLu8/q43YcJhkLI0k5s= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777456720; c=relaxed/simple; bh=6QU1C61dVfFVlOPKFdiGl4t3RT9nxVFUC3MlV3nJTps=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=QKcqg+gdU/nkHJPkIkdfz5ydcGKJwtaeIVvx69ooQt0p47OUQHEqeF2sjIFeGy6jbsi/KstbdVEhqTuK7hkya5ZjSe770VM2gZWsaddp6KFYHj8fNspSWQiPGvTGOVPS322IcowBhrzMLQpfIOkp2GmLKksUo6GsqEV8oBUxn3k= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=anirudhrb.com; spf=pass smtp.mailfrom=anirudhrb.com; dkim=pass (1024-bit key) header.d=anirudhrb.com header.i=anirudh@anirudhrb.com header.b=JHxJCO1Q; arc=pass smtp.client-ip=136.143.188.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=anirudhrb.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=anirudhrb.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=anirudhrb.com header.i=anirudh@anirudhrb.com header.b="JHxJCO1Q" ARC-Seal: i=1; a=rsa-sha256; t=1777456693; cv=none; d=zohomail.com; s=zohoarc; b=k8eYySm5rte5dOpghLzWz7U2Cl0+B/3NNCvUDDg8surn6nlwomre0RJ8HZI8qmpuCds8a4KEx8dW/YSIdm4Ovn9XAIAmAzGYYN34FWV3piTYrMfgkGK3/9wNKn+h+UFPliin6Ho88HtiusprHSB0dM3XRiRH/lqIv6KqoXv+gjo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777456693; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=ob/2PX7t4Nbz9UfHxyrsNw7aDi/Gmqo70zNjo5z65VY=; b=eNV+oqoNGUJMlm/71QrXgXyin31sJoJb8eJoFlWQhRhKIRc7ZJkFCcK8D89lLtkyY+x/318H0z/fLroK8/jITlXfj5eQeZv2SQx0ZKSMz9AYVqTYji3ZX4Ipm0nbO9a+micyq5A533RGdAwHrwIBnmJtO0H56sA4yjDkRKxIqSE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=anirudhrb.com; spf=pass smtp.mailfrom=anirudh@anirudhrb.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1777456693; s=zoho; d=anirudhrb.com; i=anirudh@anirudhrb.com; h=Date:Date:From:From:To:To:Cc:Cc:Subject:Subject:Message-ID:References:MIME-Version:Content-Type:In-Reply-To:Message-Id:Reply-To; bh=ob/2PX7t4Nbz9UfHxyrsNw7aDi/Gmqo70zNjo5z65VY=; b=JHxJCO1QCxxNQfBAipXdLv5mP6i+ZhXRswJLf+D/AOidiw18DLlgrOzpJLVnRDsL /2/Bg/Te69enWe42APU9+9mx0MyPmPfc0XMrkK6BOOYtqht7W89kdeQJvq9XxIrPOA5 sDigO1ZRAtnDOwoMart1PPlEKc8d9ZaNEZp60woA= Received: by mx.zohomail.com with SMTPS id 1777456690248423.87477393075324; Wed, 29 Apr 2026 02:58:10 -0700 (PDT) Date: Wed, 29 Apr 2026 09:58:04 +0000 From: Anirudh Rayabharam To: Jork Loeser Cc: linux-hyperv@vger.kernel.org, x86@kernel.org, "K . Y . Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Long Li , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H . Peter Anvin" , Arnd Bergmann , Michael Kelley , linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org Subject: Re: [PATCH v4 1/3] mshv: limit SynIC management to MSHV-owned resources Message-ID: <20260429-dancing-augmented-chicken-8711a6@anirudhrb> References: <20260427213855.1675044-1-jloeser@linux.microsoft.com> <20260427213855.1675044-2-jloeser@linux.microsoft.com> Precedence: bulk X-Mailing-List: linux-arch@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260427213855.1675044-2-jloeser@linux.microsoft.com> X-ZohoMailClient: External On Mon, Apr 27, 2026 at 02:38:52PM -0700, Jork Loeser wrote: > The SynIC is shared between VMBus and MSHV. VMBus owns the message > page (SIMP), event flags page (SIEFP), global enable (SCONTROL), > and SINT2. MSHV adds SINT0, SINT5, and the event ring page (SIRBP). > > Currently mshv_synic_cpu_init() redundantly enables SIMP, SIEFP, and > SCONTROL that VMBus already configured, and mshv_synic_cpu_exit() > disables all of them. This is wrong because MSHV can be torn down > while VMBus is still active. In particular, a kexec reboot notifier > tears down MSHV first. Disabling SCONTROL, SIMP, and SIEFP out > from under VMBus causes its later cleanup to write SynIC MSRs while > SynIC is disabled, which the hypervisor does not tolerate. > > Restrict MSHV to managing only the resources it owns: > - SINT0, SINT5: mask on cleanup, unmask on init > - SIRBP: enable/disable as before > - SIMP, SIEFP, SCONTROL: leave to VMBus when it is active (L1VH > and nested root partition); on a non-nested root partition VMBus > does not run, so MSHV must enable/disable them > > While here, fix the SIEFP and SIRBP memremap() and virt_to_phys() > calls to use HV_HYP_PAGE_SHIFT/HV_HYP_PAGE_SIZE instead of > PAGE_SHIFT/PAGE_SIZE. The hypervisor always uses 4K pages for SynIC > register GPAs regardless of the kernel page size, so using PAGE_SHIFT > produces wrong addresses on ARM64 with 64K pages. > > Note that initialization order matters - VMBUS first, MSHV second, > and the reverse on de-init. Ideally, we would want a dedicated SYNIC > driver that replaces the cross-dependencies with a clear API and > dynamic tracking. Such refactor should go into its own dedicated > series, outside of this kexec fix series. > > Signed-off-by: Jork Loeser > --- > drivers/hv/hv.c | 3 + > drivers/hv/mshv_synic.c | 150 ++++++++++++++++++++++++++-------------- > 2 files changed, 103 insertions(+), 50 deletions(-) Reviewed-by: Anirudh Rayabharam (Microsoft)