linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* linux-next: manual merge of the hyperv tree with Linus' tree
@ 2021-05-12  3:19 Stephen Rothwell
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Rothwell @ 2021-05-12  3:19 UTC (permalink / raw)
  To: Wei Liu
  Cc: Andrea Parri (Microsoft),
	Linux Kernel Mailing List, Linux Next Mailing List

[-- Attachment #1: Type: text/plain, Size: 807 bytes --]

Hi all,

Today's linux-next merge of the hyperv tree got a conflict in:

  drivers/hv/ring_buffer.c

between commit:

  0c85c54bf7fa ("Drivers: hv: vmbus: Drop error message when 'No request id available'")

from Linus' tree and commit:

  8e74d1f319bf ("scsi: storvsc: Use blk_mq_unique_tag() to generate requestIDs")

from the hyperv tree.

I fixed it up (I just used the latter as it included the former) and
can carry the fix as necessary. This is now fixed as far as linux-next
is concerned, but any non trivial conflicts should be mentioned to your
upstream maintainer when your tree is submitted for merging.  You may
also want to consider cooperating with the maintainer of the conflicting
tree to minimise any particularly complex conflicts.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: linux-next: manual merge of the hyperv tree with Linus' tree
  2021-02-05  8:02 Stephen Rothwell
@ 2021-02-05 10:13 ` Wei Liu
  0 siblings, 0 replies; 4+ messages in thread
From: Wei Liu @ 2021-02-05 10:13 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Wei Liu, Dexuan Cui, Lillian Grassin-Drake,
	Linux Kernel Mailing List, Linux Next Mailing List,
	Sunil Muthuswamy

On Fri, Feb 05, 2021 at 07:02:02PM +1100, Stephen Rothwell wrote:
> Hi all,
> 
> Today's linux-next merge of the hyperv tree got a conflict in:
> 
>   arch/x86/hyperv/hv_init.c
> 
> between commit:
> 
>   fff7b5e6ee63 ("x86/hyperv: Initialize clockevents after LAPIC is initialized")
> 
> from Linus' tree and commits:
> 
>   a06c2e7df586 ("x86/hyperv: extract partition ID from Microsoft Hypervisor if necessary")
>   fa2c411b58fe ("x86/hyperv: implement an MSI domain for root partition")
> 
> from the hyperv tree.
> 
> I fixed it up (see below) and can carry the fix as necessary. This
> is now fixed as far as linux-next is concerned, but any non trivial
> conflicts should be mentioned to your upstream maintainer when your tree
> is submitted for merging.  You may also want to consider cooperating
> with the maintainer of the conflicting tree to minimise any particularly
> complex conflicts.
> 

Thanks Stephen.

I've fixed up the conflicts locally in hyperv-next.

Wei.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* linux-next: manual merge of the hyperv tree with Linus' tree
@ 2021-02-05  8:02 Stephen Rothwell
  2021-02-05 10:13 ` Wei Liu
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Rothwell @ 2021-02-05  8:02 UTC (permalink / raw)
  To: Wei Liu
  Cc: Dexuan Cui, Lillian Grassin-Drake, Linux Kernel Mailing List,
	Linux Next Mailing List, Sunil Muthuswamy

[-- Attachment #1: Type: text/plain, Size: 5318 bytes --]

Hi all,

Today's linux-next merge of the hyperv tree got a conflict in:

  arch/x86/hyperv/hv_init.c

between commit:

  fff7b5e6ee63 ("x86/hyperv: Initialize clockevents after LAPIC is initialized")

from Linus' tree and commits:

  a06c2e7df586 ("x86/hyperv: extract partition ID from Microsoft Hypervisor if necessary")
  fa2c411b58fe ("x86/hyperv: implement an MSI domain for root partition")

from the hyperv tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc arch/x86/hyperv/hv_init.c
index 6375967a8244,5ad48e8033e3..000000000000
--- a/arch/x86/hyperv/hv_init.c
+++ b/arch/x86/hyperv/hv_init.c
@@@ -26,9 -26,11 +27,13 @@@
  #include <linux/cpuhotplug.h>
  #include <linux/syscore_ops.h>
  #include <clocksource/hyperv_timer.h>
+ #include <linux/highmem.h>
+ 
+ u64 hv_current_partition_id = ~0ull;
+ EXPORT_SYMBOL_GPL(hv_current_partition_id);
  
 +int hyperv_init_cpuhp;
 +
  void *hv_hypercall_pg;
  EXPORT_SYMBOL_GPL(hv_hypercall_pg);
  
@@@ -315,25 -339,24 +342,43 @@@ static struct syscore_ops hv_syscore_op
  	.resume		= hv_resume,
  };
  
 +static void (* __initdata old_setup_percpu_clockev)(void);
 +
 +static void __init hv_stimer_setup_percpu_clockev(void)
 +{
 +	/*
 +	 * Ignore any errors in setting up stimer clockevents
 +	 * as we can run with the LAPIC timer as a fallback.
 +	 */
 +	(void)hv_stimer_alloc();
 +
 +	/*
 +	 * Still register the LAPIC timer, because the direct-mode STIMER is
 +	 * not supported by old versions of Hyper-V. This also allows users
 +	 * to switch to LAPIC timer via /sys, if they want to.
 +	 */
 +	if (old_setup_percpu_clockev)
 +		old_setup_percpu_clockev();
 +}
 +
+ static void __init hv_get_partition_id(void)
+ {
+ 	struct hv_get_partition_id *output_page;
+ 	u64 status;
+ 	unsigned long flags;
+ 
+ 	local_irq_save(flags);
+ 	output_page = *this_cpu_ptr(hyperv_pcpu_output_arg);
+ 	status = hv_do_hypercall(HVCALL_GET_PARTITION_ID, NULL, output_page);
+ 	if ((status & HV_HYPERCALL_RESULT_MASK) != HV_STATUS_SUCCESS) {
+ 		/* No point in proceeding if this failed */
+ 		pr_err("Failed to get partition ID: %lld\n", status);
+ 		BUG();
+ 	}
+ 	hv_current_partition_id = output_page->partition_id;
+ 	local_irq_restore(flags);
+ }
+ 
  /*
   * This function is to be invoked early in the boot sequence after the
   * hypervisor has been detected.
@@@ -408,18 -437,41 +459,45 @@@ void __init hyperv_init(void
  
  	rdmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64);
  	hypercall_msr.enable = 1;
- 	hypercall_msr.guest_physical_address = vmalloc_to_pfn(hv_hypercall_pg);
- 	wrmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64);
+ 
+ 	if (hv_root_partition) {
+ 		struct page *pg;
+ 		void *src, *dst;
+ 
+ 		/*
+ 		 * For the root partition, the hypervisor will set up its
+ 		 * hypercall page. The hypervisor guarantees it will not show
+ 		 * up in the root's address space. The root can't change the
+ 		 * location of the hypercall page.
+ 		 *
+ 		 * Order is important here. We must enable the hypercall page
+ 		 * so it is populated with code, then copy the code to an
+ 		 * executable page.
+ 		 */
+ 		wrmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64);
+ 
+ 		pg = vmalloc_to_page(hv_hypercall_pg);
+ 		dst = kmap(pg);
+ 		src = memremap(hypercall_msr.guest_physical_address << PAGE_SHIFT, PAGE_SIZE,
+ 				MEMREMAP_WB);
+ 		BUG_ON(!(src && dst));
+ 		memcpy(dst, src, HV_HYP_PAGE_SIZE);
+ 		memunmap(src);
+ 		kunmap(pg);
+ 	} else {
+ 		hypercall_msr.guest_physical_address = vmalloc_to_pfn(hv_hypercall_pg);
+ 		wrmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64);
+ 	}
  
  	/*
 -	 * Ignore any errors in setting up stimer clockevents
 -	 * as we can run with the LAPIC timer as a fallback.
 +	 * hyperv_init() is called before LAPIC is initialized: see
 +	 * apic_intr_mode_init() -> x86_platform.apic_post_init() and
 +	 * apic_bsp_setup() -> setup_local_APIC(). The direct-mode STIMER
 +	 * depends on LAPIC, so hv_stimer_alloc() should be called from
 +	 * x86_init.timers.setup_percpu_clockev.
  	 */
 -	(void)hv_stimer_alloc();
 +	old_setup_percpu_clockev = x86_init.timers.setup_percpu_clockev;
 +	x86_init.timers.setup_percpu_clockev = hv_stimer_setup_percpu_clockev;
  
  	hv_apic_init();
  
@@@ -427,7 -479,20 +505,22 @@@
  
  	register_syscore_ops(&hv_syscore_ops);
  
 +	hyperv_init_cpuhp = cpuhp;
++
+ 	if (cpuid_ebx(HYPERV_CPUID_FEATURES) & HV_ACCESS_PARTITION_ID)
+ 		hv_get_partition_id();
+ 
+ 	BUG_ON(hv_root_partition && hv_current_partition_id == ~0ull);
+ 
+ #ifdef CONFIG_PCI_MSI
+ 	/*
+ 	 * If we're running as root, we want to create our own PCI MSI domain.
+ 	 * We can't set this in hv_pci_init because that would be too late.
+ 	 */
+ 	if (hv_root_partition)
+ 		x86_init.irqs.create_pci_msi_domain = hv_create_pci_msi_domain;
+ #endif
+ 
  	return;
  
  remove_cpuhp_state:

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* linux-next: manual merge of the hyperv tree with Linus' tree
@ 2019-07-09  9:53 Stephen Rothwell
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Rothwell @ 2019-07-09  9:53 UTC (permalink / raw)
  To: Sasha Levin
  Cc: Linux Next Mailing List, Linux Kernel Mailing List,
	Michael Kelley, Thomas Gleixner

[-- Attachment #1: Type: text/plain, Size: 3274 bytes --]

Hi all,

Today's linux-next merge of the hyperv tree got a conflict in:

  arch/x86/include/asm/mshyperv.h

between commit:

  dd2cb348613b ("clocksource/drivers: Continue making Hyper-V clocksource ISA agnostic")

from Linus' tree and commit:

  765e33f5211a ("Drivers: hv: vmbus: Break out ISA independent parts of mshyperv.h")

from the hyperv tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc arch/x86/include/asm/mshyperv.h
index f4fa8a9d5d0b,080a92025748..000000000000
--- a/arch/x86/include/asm/mshyperv.h
+++ b/arch/x86/include/asm/mshyperv.h
@@@ -397,4 -246,76 +256,6 @@@ static inline int hyperv_flush_guest_ma
  }
  #endif /* CONFIG_HYPERV */
  
 -#ifdef CONFIG_HYPERV_TSCPAGE
 -struct ms_hyperv_tsc_page *hv_get_tsc_page(void);
 -static inline u64 hv_read_tsc_page_tsc(const struct ms_hyperv_tsc_page *tsc_pg,
 -				       u64 *cur_tsc)
 -{
 -	u64 scale, offset;
 -	u32 sequence;
 -
 -	/*
 -	 * The protocol for reading Hyper-V TSC page is specified in Hypervisor
 -	 * Top-Level Functional Specification ver. 3.0 and above. To get the
 -	 * reference time we must do the following:
 -	 * - READ ReferenceTscSequence
 -	 *   A special '0' value indicates the time source is unreliable and we
 -	 *   need to use something else. The currently published specification
 -	 *   versions (up to 4.0b) contain a mistake and wrongly claim '-1'
 -	 *   instead of '0' as the special value, see commit c35b82ef0294.
 -	 * - ReferenceTime =
 -	 *        ((RDTSC() * ReferenceTscScale) >> 64) + ReferenceTscOffset
 -	 * - READ ReferenceTscSequence again. In case its value has changed
 -	 *   since our first reading we need to discard ReferenceTime and repeat
 -	 *   the whole sequence as the hypervisor was updating the page in
 -	 *   between.
 -	 */
 -	do {
 -		sequence = READ_ONCE(tsc_pg->tsc_sequence);
 -		if (!sequence)
 -			return U64_MAX;
 -		/*
 -		 * Make sure we read sequence before we read other values from
 -		 * TSC page.
 -		 */
 -		smp_rmb();
 -
 -		scale = READ_ONCE(tsc_pg->tsc_scale);
 -		offset = READ_ONCE(tsc_pg->tsc_offset);
 -		*cur_tsc = rdtsc_ordered();
 -
 -		/*
 -		 * Make sure we read sequence after we read all other values
 -		 * from TSC page.
 -		 */
 -		smp_rmb();
 -
 -	} while (READ_ONCE(tsc_pg->tsc_sequence) != sequence);
 -
 -	return mul_u64_u64_shr(*cur_tsc, scale, 64) + offset;
 -}
 -
 -static inline u64 hv_read_tsc_page(const struct ms_hyperv_tsc_page *tsc_pg)
 -{
 -	u64 cur_tsc;
 -
 -	return hv_read_tsc_page_tsc(tsc_pg, &cur_tsc);
 -}
 -
 -#else
 -static inline struct ms_hyperv_tsc_page *hv_get_tsc_page(void)
 -{
 -	return NULL;
 -}
 -
 -static inline u64 hv_read_tsc_page_tsc(const struct ms_hyperv_tsc_page *tsc_pg,
 -				       u64 *cur_tsc)
 -{
 -	BUG();
 -	return U64_MAX;
 -}
 -#endif
 -
+ #include <asm-generic/mshyperv.h>
+ 
  #endif

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-05-12  3:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-12  3:19 linux-next: manual merge of the hyperv tree with Linus' tree Stephen Rothwell
  -- strict thread matches above, loose matches on Subject: below --
2021-02-05  8:02 Stephen Rothwell
2021-02-05 10:13 ` Wei Liu
2019-07-09  9:53 Stephen Rothwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).