[xen-unstable test] 182725: regressions - FAIL

2023-09-08 Thread osstest service owner
flight 182725 xen-unstable real [real]
http://logs.test-lab.xenproject.org/osstest/logs/182725/

Regressions :-(

Tests which did not succeed and are blocking,
including tests which could not be run:
 test-amd64-i386-migrupgrade  10 xen-install/src_host fail REGR. vs. 182717
 build-arm64   6 xen-buildfail REGR. vs. 182717

Tests which did not succeed, but are not blocking:
 build-arm64-libvirt   1 build-check(1)   blocked  n/a
 test-arm64-arm64-examine  1 build-check(1)   blocked  n/a
 test-arm64-arm64-libvirt-raw  1 build-check(1)   blocked  n/a
 test-arm64-arm64-libvirt-xsm  1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl   1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl-credit1   1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl-credit2   1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl-thunderx  1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl-vhd   1 build-check(1)   blocked  n/a
 test-amd64-i386-migrupgrade  11 xen-install/dst_host fail  like 182717
 test-amd64-amd64-xl-qemut-win7-amd64 19 guest-stopfail like 182717
 test-amd64-i386-xl-qemuu-win7-amd64 19 guest-stop fail like 182717
 test-armhf-armhf-libvirt-qcow2 15 saverestore-support-check   fail like 182717
 test-armhf-armhf-libvirt-raw 15 saverestore-support-checkfail  like 182717
 test-amd64-amd64-xl-qemuu-ws16-amd64 19 guest-stopfail like 182717
 test-amd64-i386-xl-qemut-ws16-amd64 19 guest-stop fail like 182717
 test-amd64-i386-xl-qemut-win7-amd64 19 guest-stop fail like 182717
 test-armhf-armhf-libvirt 16 saverestore-support-checkfail  like 182717
 test-amd64-amd64-qemuu-nested-amd 20 debian-hvm-install/l1/l2 fail like 182717
 test-amd64-amd64-xl-qemut-ws16-amd64 19 guest-stopfail like 182717
 test-amd64-i386-xl-qemuu-ws16-amd64 19 guest-stop fail like 182717
 test-amd64-amd64-xl-qemuu-win7-amd64 19 guest-stopfail like 182717
 test-amd64-amd64-libvirt-xsm 15 migrate-support-checkfail   never pass
 test-amd64-amd64-libvirt 15 migrate-support-checkfail   never pass
 test-amd64-i386-xl-pvshim14 guest-start  fail   never pass
 test-amd64-i386-libvirt-xsm  15 migrate-support-checkfail   never pass
 test-amd64-i386-libvirt  15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-xsm  15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-xsm  16 saverestore-support-checkfail   never pass
 test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm 13 migrate-support-check 
fail never pass
 test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm 13 migrate-support-check 
fail never pass
 test-armhf-armhf-xl-arndale  15 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-arndale  16 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-multivcpu 15 migrate-support-checkfail  never pass
 test-armhf-armhf-xl-multivcpu 16 saverestore-support-checkfail  never pass
 test-armhf-armhf-xl  15 migrate-support-checkfail   never pass
 test-armhf-armhf-xl  16 saverestore-support-checkfail   never pass
 test-amd64-i386-libvirt-raw  14 migrate-support-checkfail   never pass
 test-amd64-amd64-libvirt-vhd 14 migrate-support-checkfail   never pass
 test-armhf-armhf-libvirt-qcow2 14 migrate-support-checkfail never pass
 test-armhf-armhf-libvirt-raw 14 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-vhd  14 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-vhd  15 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-rtds 15 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-rtds 16 saverestore-support-checkfail   never pass
 test-armhf-armhf-libvirt 15 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-credit2  15 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-credit2  16 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-credit1  15 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-credit1  16 saverestore-support-checkfail   never pass

version targeted for testing:
 xen  1f79fce10a75f88d2c2a6ace469a4046bc1b9cb5
baseline version:
 xen  b2dd946ece74e2b6e0601f28caef72f4f9950102

Last test of basis   182717  2023-09-07 07:54:20 Z0 days
Testing same since   182725  2023-09-08 00:38:36 Z0 days1 attempts


People who touched revisions under test:
  Federico Serafini 
  Henry Wang 
  Jan Beulich 
  Nicola Vetrini 
  Stefano Stabellini 

jobs:
 build-amd64-xsm  pass
 build-arm64-xsm  

Re: [PATCH v7 9/9] swiotlb: search the software IO TLB only if the device makes use of it

2023-09-08 Thread Christoph Hellwig
On Thu, Sep 07, 2023 at 01:12:23PM +0200, Petr Tesařík wrote:
> Hi all,
> 
> sorry for my late reply; I've been away from my work setup for a
> month...

Please take a look at:

https://lore.kernel.org/linux-iommu/20230905064441.127588-1-...@lst.de/T/#u




Re: [XEN PATCH 2/3] docs: make the docs for MISRA C:2012 Dir 4.1 visible to ECLAIR

2023-09-08 Thread Nicola Vetrini

On 08/09/2023 02:23, Stefano Stabellini wrote:

On Fri, 1 Sep 2023, Nicola Vetrini wrote:

To be able to check for the existence of the necessary subsections in
the documentation for MISRA C:2012 Dir 4.1, ECLAIR needs to have a 
source

file that is built.

This file is generated from 'C-runtime-failures.rst' in docs/misra
and the configuration is updated accordingly.

Signed-off-by: Nicola Vetrini 
---
Changes from RFC:
- Dropped unused/useless code
- Revised the sed command
- Revised the clean target
---
 docs/Makefile   |  7 ++-
 docs/misra/Makefile | 17 +
 2 files changed, 23 insertions(+), 1 deletion(-)
 create mode 100644 docs/misra/Makefile

diff --git a/docs/Makefile b/docs/Makefile
index 966a104490ac..ff991a0c3ca2 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -43,7 +43,7 @@ DOC_PDF  := $(patsubst 
%.pandoc,pdf/%.pdf,$(PANDOCSRC-y)) \

 all: build

 .PHONY: build
-build: html txt pdf man-pages figs
+build: html txt pdf man-pages figs misra

 .PHONY: sphinx-html
 sphinx-html:
@@ -66,9 +66,14 @@ endif
 .PHONY: pdf
 pdf: $(DOC_PDF)

+.PHONY: misra
+misra:
+   $(MAKE) -C misra
+
 .PHONY: clean
 clean: clean-man-pages
$(MAKE) -C figs clean
+   $(MAKE) -C misra clean
rm -rf .word_count *.aux *.dvi *.bbl *.blg *.glo *.idx *~
rm -rf *.ilg *.log *.ind *.toc *.bak *.tmp core
rm -rf html txt pdf sphinx/html
diff --git a/docs/misra/Makefile b/docs/misra/Makefile
new file mode 100644
index ..8ea0505c8a20
--- /dev/null
+++ b/docs/misra/Makefile
@@ -0,0 +1,17 @@
+TARGETS := C-runtime-failures.o
+
+all: $(TARGETS)
+
+# sed is used in place of cat to prevent occurrences of '*/'
+# in the .rst from breaking the compilation


Please expand this comment with what you are doing in this makefile and
specifically what kind of .c file you are generating and why.

Everything else looks good.



Ok

--
Nicola Vetrini, BSc
Software Engineer, BUGSENG srl (https://bugseng.com)



Re: [XEN PATCH 3/3] automation/eclair: build docs/misra to address MISRA C:2012 Dir 4.1

2023-09-08 Thread Nicola Vetrini

On 08/09/2023 02:25, Stefano Stabellini wrote:

On Fri, 1 Sep 2023, Nicola Vetrini wrote:

The documentation pertaining Directive 4.1 is contained in docs/misra.
The build script driving the analysis is amended to allow ECLAIR to
analyze such file.

Signed-off-by: Nicola Vetrini 
---
 automation/eclair_analysis/build.sh   | 11 ---
 automation/eclair_analysis/prepare.sh |  5 +++--
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/automation/eclair_analysis/build.sh 
b/automation/eclair_analysis/build.sh

index ec087dd822fa..556ed698bf8b 100755
--- a/automation/eclair_analysis/build.sh
+++ b/automation/eclair_analysis/build.sh
@@ -34,11 +34,16 @@ else
 fi

 (
-  cd xen
-
   make "-j${PROCESSORS}" "-l${PROCESSORS}.0"\
"CROSS_COMPILE=${CROSS_COMPILE}" \
"CC=${CROSS_COMPILE}gcc-12"  \
"CXX=${CROSS_COMPILE}g++-12" \
-   "XEN_TARGET_ARCH=${XEN_TARGET_ARCH}"
+   "XEN_TARGET_ARCH=${XEN_TARGET_ARCH}" \
+   -C docs misra


I don't think you need all these options to generate docs and misra.
Probably it would be sufficient just make -C docs misra

However given that they are not harmful:

Reviewed-by: Stefano Stabellini 




Ok, I'll try it out for the next version, otherwise I'll revert to this 
invocation.


--
Nicola Vetrini, BSc
Software Engineer, BUGSENG srl (https://bugseng.com)



Re: [XEN PATCH 1/3] docs/misra: add documentation skeleton for MISRA C:2012 Dir 4.1

2023-09-08 Thread Nicola Vetrini

On 08/09/2023 08:33, Jan Beulich wrote:

On 08.09.2023 02:20, Stefano Stabellini wrote:

On Fri, 1 Sep 2023, Nicola Vetrini wrote:
+Documentation for MISRA C:2012 Dir 4.1: read from uninitialized 
allocated object

+
+
+To be written.
+Example:
+The code does not use dynamically allocated storage.


We do use dynamically allocated storage with xzalloc but xzalloc
initializes the object to zero


Just at the example of this: I'm not sure in how far the examples given
were actually meant to (remotely) apply to our code base. As to your
reply - there's also xmalloc() which doesn't, and the page allocator,
and other more specialized ones.



You're right in saying that these examples are not tied to Xen 
specifically, these categories
of runtime failures are just the default ones present in ECLAIR. Both 
the matched text and

the categories can be amended, if the community deems it valuable.

--
Nicola Vetrini, BSc
Software Engineer, BUGSENG srl (https://bugseng.com)



Re: [XEN PATCH 1/3] docs/misra: add documentation skeleton for MISRA C:2012 Dir 4.1

2023-09-08 Thread Nicola Vetrini




diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
index 34916e266aa5..84bb57c8e908 100644
--- a/docs/misra/rules.rst
+++ b/docs/misra/rules.rst
@@ -47,7 +47,12 @@ maintainers if you want to suggest a change.
* - `Dir 2.1 
`_

  - Required
  - All source files shall compile without any compilation errors
- -
+
+   * - `Dir 4.1 
`_

+ - Required
+ - Run-time failures shall be minimized
+ - The strategies adopted by Xen to prevent certain classes of 
runtime
+   failures will be documented by `C-runtime-failures.rst 
`_


I would say "is documented" because we don't want to go back and change
rules.rst if/when we update C-runtime-failures.rst

Also (nit) you can wrap around at 80 chars to make it easier to read as
it will still be displayed the same way by gitlab and other RST
renderers



* - `Dir 4.7 
`_

  - Required


Ok

--
Nicola Vetrini, BSc
Software Engineer, BUGSENG srl (https://bugseng.com)



Re: [XEN PATCH] xen/types: address Rule 10.1 for macro BITS_TO_LONGS

2023-09-08 Thread Nicola Vetrini

On 07/09/2023 03:33, Stefano Stabellini wrote:

On Wed, 6 Sep 2023, Jan Beulich wrote:

On 06.09.2023 17:57, Nicola Vetrini wrote:
> On 05/09/2023 10:33, Jan Beulich wrote:
>> On 05.09.2023 10:20, Nicola Vetrini wrote:
>>> On 05/09/2023 09:46, Jan Beulich wrote:
 On 05.09.2023 09:31, Nicola Vetrini wrote:
> Given its use in the declaration
> 'DECLARE_BITMAP(features, IOMMU_FEAT_count)' the argument
> 'bits' has essential type 'enum iommu_feature', which is not
> allowed by the Rule as an operand to the addition operator.
> Given that its value can be represented by a signed integer,
> the explicit cast resolves the violation.

 Wait - why would this lead to a change to BITS_TO_LONGS()? And if
 that
 was to be changed, why plain int? I don't think negative input makes
 sense there, and in principle I'd expect values beyond 4 billion to
 also be permissible (even if likely no such use will ever appear in a
 DECLARE_BITMAP(), but elsewhere it may make sense). Even going to
 "unsigned long" may be too limiting ...

>>>
>>> You have a point. I can think of doing it like this:
>>> DECLARE_BITMAP(features, (int)IOMMU_FEAT_count)


I think this is a good solution for this case (even more so if we can't
find a better implementation of BITS_TO_LONGS)



>>> on the grounds that the enum constant is representable in an int, and
>>> it
>>> does not seem likely
>>> to get much bigger.
>>> Having an unsigned cast requires making the whole expression
>>> essentially unsigned, otherwise Rule 10.4 is violated because
>>> BITS_PER_LONG is
>>> essentially signed. This can be done, but it depends on how
>>> BITS_TO_LONGS will be/is used.
>>
>> It'll need looking closely, yes, but I expect that actually wants to be
>> an
>> unsigned constant. I wouldn't be surprised if some use of
>> DECLARE_BITMAP()
>> appeared (or already existed) where the 2nd argument involves sizeof()
>> in
>> some way.
>>
>
> I think there's one with ARRAY_SIZE. In my opinion this can be resolved
> as follows:
>
> #define BYTES_PER_LONG (1U << LONG_BYTEORDER) // the essential type gets
> from signed to unsigned
>
> #define BITS_TO_LONGS(bits) \
>  (((unsigned long long)(bits)+BITS_PER_LONG-1U)/BITS_PER_LONG) //
> same here

Except, as said before, I consider any kind of cast on "bits" latently
problematic.


Can't we just do this (same but without the cast):

#define BYTES_PER_LONG (1U << LONG_BYTEORDER)
#define BITS_TO_LONGS(bits) \
 (((bits)+BITS_PER_LONG-1U)/BITS_PER_LONG)

Then we just need to make sure to pass an unsigned to BITS_TO_LONGS. In
the case above we would do:

DECLARE_BITMAP(features, (unsigned int)IOMMU_FEAT_count)


There is a build error due to -Werror because of a pointer comparison at 
line 469 of common/numa.c:

i = min(PADDR_BITS, BITS_PER_LONG - 1);
where
#define PADDR_BITS  52

I guess PADDR_BITS can become unsigned or gain a cast

--
Nicola Vetrini, BSc
Software Engineer, BUGSENG srl (https://bugseng.com)



Re: [PATCH v2] docs/misra: add 14.3

2023-09-08 Thread Nicola Vetrini

On 07/09/2023 23:45, Stefano Stabellini wrote:

On Thu, 7 Sep 2023, Jan Beulich wrote:

On 07.09.2023 03:22, Stefano Stabellini wrote:
> @@ -385,6 +386,17 @@ maintainers if you want to suggest a change.
>   - A loop counter shall not have essentially floating type
>   -
>
> +   * - `Rule 14.3 
`_
> + - Required
> + - Controlling expressions shall not be invariant
> + - Due to the extensive usage of IS_ENABLED, sizeof compile-time
> +   checks, and other constructs that are detected as errors by MISRA
> +   C scanners, managing the configuration of a MISRA C scanner for
> +   this rule would be unmanageable. Thus, this rule is adopted with
> +   a project-wide deviation on if ?: and switch statements.

Do we want to go as far as permitting this uniformly for all switch()? 
In

my earlier reply I had included sizeof() for a reason.


I agree with you that it would be better to restrict it to only some
switch uses, rather than all of them.

But if we are going to restrict the deviation to switch(sizeof()), 
which

I think is a good idea and I am in favor, wouldn't it be better to
handle these cases as individual deviations? E.g. docs/misra/safe.json?
I am assuming there are only few cases like that and adding it here
makes the rule more complicated.

I am happy either way but I wanted to provide that as an option.




It's also worth considering the magnitude of required SAF comments when 
making this choice.
In this case, from a cursory glance at the present violations, it seems 
that there are maybe a
handful of switches inside macros, so they shouldn't be problematic to 
deal with.


--
Nicola Vetrini, BSc
Software Engineer, BUGSENG srl (https://bugseng.com)



[ovmf test] 182732: all pass - PUSHED

2023-09-08 Thread osstest service owner
flight 182732 ovmf real [real]
http://logs.test-lab.xenproject.org/osstest/logs/182732/

Perfect :-)
All tests in this flight passed as required
version targeted for testing:
 ovmf 2ce5ae43c2166984d20341993c4b9dbb337aad79
baseline version:
 ovmf 634192665ea22eb610ad54f10bad8143ef77076d

Last test of basis   182727  2023-09-08 03:42:30 Z0 days
Testing same since   182732  2023-09-08 06:40:46 Z0 days1 attempts


People who touched revisions under test:
  Dun Tan 

jobs:
 build-amd64-xsm  pass
 build-i386-xsm   pass
 build-amd64  pass
 build-i386   pass
 build-amd64-libvirt  pass
 build-i386-libvirt   pass
 build-amd64-pvopspass
 build-i386-pvops pass
 test-amd64-amd64-xl-qemuu-ovmf-amd64 pass
 test-amd64-i386-xl-qemuu-ovmf-amd64  pass



sg-report-flight on osstest.test-lab.xenproject.org
logs: /home/logs/logs
images: /home/logs/images

Logs, config files, etc. are available at
http://logs.test-lab.xenproject.org/osstest/logs

Explanation of these reports, and of osstest in general, is at
http://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=README.email;hb=master
http://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=README;hb=master

Test harness code can be found at
http://xenbits.xen.org/gitweb?p=osstest.git;a=summary


Pushing revision :

To xenbits.xen.org:/home/xen/git/osstest/ovmf.git
   634192665e..2ce5ae43c2  2ce5ae43c2166984d20341993c4b9dbb337aad79 -> 
xen-tested-master



[XEN PATCH] x86: change parameter name in {hap,shadow}_track_dirty_vram()

2023-09-08 Thread Federico Serafini
Make function declarations consistent with the corresponding
definitions to address violations of MISRA C:2012 Rule 8.3.
No functional change.

Signed-off-by: Federico Serafini 
---
 xen/arch/x86/include/asm/hap.h| 2 +-
 xen/arch/x86/include/asm/shadow.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/include/asm/hap.h b/xen/arch/x86/include/asm/hap.h
index 9d12327b12..05e124ad57 100644
--- a/xen/arch/x86/include/asm/hap.h
+++ b/xen/arch/x86/include/asm/hap.h
@@ -30,7 +30,7 @@ void  hap_vcpu_init(struct vcpu *v);
 int   hap_track_dirty_vram(struct domain *d,
unsigned long begin_pfn,
unsigned int nr_frames,
-   XEN_GUEST_HANDLE(void) dirty_bitmap);
+   XEN_GUEST_HANDLE(void) guest_dirty_bitmap);
 
 extern const struct paging_mode *hap_paging_get_mode(struct vcpu *);
 int hap_set_allocation(struct domain *d, unsigned int pages, bool *preempted);
diff --git a/xen/arch/x86/include/asm/shadow.h 
b/xen/arch/x86/include/asm/shadow.h
index ba2b0e170b..20df34d0a8 100644
--- a/xen/arch/x86/include/asm/shadow.h
+++ b/xen/arch/x86/include/asm/shadow.h
@@ -65,7 +65,7 @@ int shadow_enable(struct domain *d, u32 mode);
 int shadow_track_dirty_vram(struct domain *d,
 unsigned long first_pfn,
 unsigned int nr_frames,
-XEN_GUEST_HANDLE(void) dirty_bitmap);
+XEN_GUEST_HANDLE(void) guest_dirty_bitmap);
 
 /* Handler for shadow control ops: operations from user-space to enable
  * and disable ephemeral shadow modes (test mode and log-dirty mode) and
-- 
2.34.1




[XEN PATCH] xen/vPCI: address violation of MISRA C:2012 Rule 8.3

2023-09-08 Thread Federico Serafini
Make function declaration consistent with the corresponding definition.
No functional change.

Signed-off-by: Federico Serafini 
---
 xen/include/xen/vpci.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/include/xen/vpci.h b/xen/include/xen/vpci.h
index 0b8a2a3c74..d743d96a10 100644
--- a/xen/include/xen/vpci.h
+++ b/xen/include/xen/vpci.h
@@ -26,7 +26,7 @@ typedef int vpci_register_init_t(struct pci_dev *dev);
__used_section(".data.vpci." p) = x
 
 /* Add vPCI handlers to device. */
-int __must_check vpci_add_handlers(struct pci_dev *dev);
+int __must_check vpci_add_handlers(struct pci_dev *pdev);
 
 /* Remove all handlers and free vpci related structures. */
 void vpci_remove_device(struct pci_dev *pdev);
-- 
2.34.1




[qemu-mainline test] 182730: regressions - FAIL

2023-09-08 Thread osstest service owner
flight 182730 qemu-mainline real [real]
http://logs.test-lab.xenproject.org/osstest/logs/182730/

Regressions :-(

Tests which did not succeed and are blocking,
including tests which could not be run:
 build-arm64-xsm   6 xen-buildfail REGR. vs. 182707
 build-i3866 xen-buildfail REGR. vs. 182707
 build-arm64   6 xen-buildfail REGR. vs. 182707
 build-amd64-xsm   6 xen-buildfail REGR. vs. 182707
 build-amd64   6 xen-buildfail REGR. vs. 182707
 build-i386-xsm6 xen-buildfail REGR. vs. 182707
 build-armhf   6 xen-buildfail REGR. vs. 182707

Tests which did not succeed, but are not blocking:
 test-amd64-i386-xl-qemuu-debianhvm-amd64  1 build-check(1) blocked n/a
 test-amd64-i386-xl-qemuu-debianhvm-amd64-shadow  1 build-check(1)  blocked n/a
 test-amd64-i386-xl-qemuu-debianhvm-i386-xsm  1 build-check(1)  blocked n/a
 test-amd64-i386-xl-qemuu-dmrestrict-amd64-dmrestrict 1 build-check(1) blocked 
n/a
 test-amd64-i386-xl-qemuu-ovmf-amd64  1 build-check(1)  blocked n/a
 test-amd64-i386-xl-qemuu-win7-amd64  1 build-check(1)  blocked n/a
 test-amd64-i386-xl-qemuu-ws16-amd64  1 build-check(1)  blocked n/a
 test-amd64-i386-xl-shadow 1 build-check(1)   blocked  n/a
 test-amd64-i386-xl-vhd1 build-check(1)   blocked  n/a
 test-amd64-i386-xl-xsm1 build-check(1)   blocked  n/a
 test-arm64-arm64-libvirt-raw  1 build-check(1)   blocked  n/a
 test-arm64-arm64-libvirt-xsm  1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl   1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl-credit1   1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl-credit2   1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl-thunderx  1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl-vhd   1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl-xsm   1 build-check(1)   blocked  n/a
 test-armhf-armhf-libvirt  1 build-check(1)   blocked  n/a
 test-armhf-armhf-libvirt-qcow2  1 build-check(1)   blocked  n/a
 test-armhf-armhf-libvirt-raw  1 build-check(1)   blocked  n/a
 test-armhf-armhf-xl   1 build-check(1)   blocked  n/a
 test-armhf-armhf-xl-arndale   1 build-check(1)   blocked  n/a
 test-armhf-armhf-xl-multivcpu  1 build-check(1)   blocked  n/a
 test-armhf-armhf-xl-rtds  1 build-check(1)   blocked  n/a
 test-armhf-armhf-xl-vhd   1 build-check(1)   blocked  n/a
 test-amd64-i386-qemuu-rhel6hvm-amd  1 build-check(1)   blocked n/a
 test-amd64-i386-pair  1 build-check(1)   blocked  n/a
 test-amd64-i386-libvirt-xsm   1 build-check(1)   blocked  n/a
 test-amd64-i386-libvirt-raw   1 build-check(1)   blocked  n/a
 test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm 1 build-check(1) blocked n/a
 test-amd64-i386-libvirt-pair  1 build-check(1)   blocked  n/a
 test-amd64-i386-libvirt   1 build-check(1)   blocked  n/a
 test-amd64-i386-freebsd10-i386  1 build-check(1)   blocked  n/a
 test-amd64-i386-freebsd10-amd64  1 build-check(1)   blocked  n/a
 test-amd64-coresched-i386-xl  1 build-check(1)   blocked  n/a
 test-amd64-coresched-amd64-xl  1 build-check(1)   blocked  n/a
 test-amd64-amd64-xl-xsm   1 build-check(1)   blocked  n/a
 build-amd64-libvirt   1 build-check(1)   blocked  n/a
 test-amd64-amd64-xl-shadow1 build-check(1)   blocked  n/a
 test-amd64-amd64-xl-rtds  1 build-check(1)   blocked  n/a
 build-arm64-libvirt   1 build-check(1)   blocked  n/a
 test-amd64-amd64-xl-qemuu-ws16-amd64  1 build-check(1) blocked n/a
 test-amd64-amd64-xl-qemuu-win7-amd64  1 build-check(1) blocked n/a
 test-amd64-amd64-xl-qemuu-ovmf-amd64  1 build-check(1) blocked n/a
 build-armhf-libvirt   1 build-check(1)   blocked  n/a
 test-amd64-amd64-xl-qemuu-dmrestrict-amd64-dmrestrict 1 build-check(1) blocked 
n/a
 build-i386-libvirt1 build-check(1)   blocked  n/a
 test-amd64-amd64-xl-qemuu-debianhvm-i386-xsm  1 build-check(1) blocked n/a
 test-amd64-amd64-dom0pvh-xl-amd  1 build-check(1)   blocked  n/a
 test-amd64-amd64-xl-qemuu-debianhvm-amd64-shadow  1 build-check(1) blocked n/a
 test-amd64-amd64-dom0pvh-xl-intel  1 build-check(1)   blocked  n/a
 test-amd64-amd64-xl-qemuu-debianhvm-amd64  1 build-check(1)blocked n/a
 test-amd64-amd64-libvirt  1 build-check(1)   blocked  n/a
 test-amd64-amd64-libvirt-pair

Re: [XEN PATCH 2/3] docs: make the docs for MISRA C:2012 Dir 4.1 visible to ECLAIR

2023-09-08 Thread Anthony PERARD
On Fri, Sep 01, 2023 at 11:06:39AM +0200, Nicola Vetrini wrote:
> diff --git a/docs/misra/Makefile b/docs/misra/Makefile
> new file mode 100644
> index ..8ea0505c8a20
> --- /dev/null
> +++ b/docs/misra/Makefile
> @@ -0,0 +1,17 @@
> +TARGETS := C-runtime-failures.o
> +
> +all: $(TARGETS)
> +
> +# sed is used in place of cat to prevent occurrences of '*/'
> +# in the .rst from breaking the compilation
> +$(TARGETS:.o=.c): %.c: %.rst
> + echo "/*\n" > $@.tmp

This doesn't really works as you expect. Depending on the shell used or
the echo binary used, the "\n" would write a  or justs "\n".
Bash just write "\n" for example, while dash does write a .
But, you can use `printf` instead:
printf "/*\n\n" > $@.tmp

> + sed -e 's|\*/|*//*|g' $< >> $@.tmp
> + echo "\n*/" >> $@.tmp

Same here.


Thanks,

-- 
Anthony PERARD



Re: [XEN PATCH] xen/types: address Rule 10.1 for macro BITS_TO_LONGS

2023-09-08 Thread Jan Beulich
On 08.09.2023 10:48, Nicola Vetrini wrote:
> On 07/09/2023 03:33, Stefano Stabellini wrote:
>> On Wed, 6 Sep 2023, Jan Beulich wrote:
>>> On 06.09.2023 17:57, Nicola Vetrini wrote:
 On 05/09/2023 10:33, Jan Beulich wrote:
> On 05.09.2023 10:20, Nicola Vetrini wrote:
>> On 05/09/2023 09:46, Jan Beulich wrote:
>>> On 05.09.2023 09:31, Nicola Vetrini wrote:
 Given its use in the declaration
 'DECLARE_BITMAP(features, IOMMU_FEAT_count)' the argument
 'bits' has essential type 'enum iommu_feature', which is not
 allowed by the Rule as an operand to the addition operator.
 Given that its value can be represented by a signed integer,
 the explicit cast resolves the violation.
>>>
>>> Wait - why would this lead to a change to BITS_TO_LONGS()? And if
>>> that
>>> was to be changed, why plain int? I don't think negative input makes
>>> sense there, and in principle I'd expect values beyond 4 billion to
>>> also be permissible (even if likely no such use will ever appear in a
>>> DECLARE_BITMAP(), but elsewhere it may make sense). Even going to
>>> "unsigned long" may be too limiting ...
>>>
>>
>> You have a point. I can think of doing it like this:
>> DECLARE_BITMAP(features, (int)IOMMU_FEAT_count)
>>
>> I think this is a good solution for this case (even more so if we can't
>> find a better implementation of BITS_TO_LONGS)
>>
>>
>> on the grounds that the enum constant is representable in an int, and
>> it
>> does not seem likely
>> to get much bigger.
>> Having an unsigned cast requires making the whole expression
>> essentially unsigned, otherwise Rule 10.4 is violated because
>> BITS_PER_LONG is
>> essentially signed. This can be done, but it depends on how
>> BITS_TO_LONGS will be/is used.
>
> It'll need looking closely, yes, but I expect that actually wants to be
> an
> unsigned constant. I wouldn't be surprised if some use of
> DECLARE_BITMAP()
> appeared (or already existed) where the 2nd argument involves sizeof()
> in
> some way.
>

 I think there's one with ARRAY_SIZE. In my opinion this can be resolved
 as follows:

 #define BYTES_PER_LONG (1U << LONG_BYTEORDER) // the essential type gets
 from signed to unsigned

 #define BITS_TO_LONGS(bits) \
  (((unsigned long long)(bits)+BITS_PER_LONG-1U)/BITS_PER_LONG) //
 same here
>>>
>>> Except, as said before, I consider any kind of cast on "bits" latently
>>> problematic.
>>
>> Can't we just do this (same but without the cast):
>>
>> #define BYTES_PER_LONG (1U << LONG_BYTEORDER)
>> #define BITS_TO_LONGS(bits) \
>>  (((bits)+BITS_PER_LONG-1U)/BITS_PER_LONG)
>>
>> Then we just need to make sure to pass an unsigned to BITS_TO_LONGS. In
>> the case above we would do:
>>
>> DECLARE_BITMAP(features, (unsigned int)IOMMU_FEAT_count)
> 
> There is a build error due to -Werror because of a pointer comparison at 
> line 469 of common/numa.c:
> i = min(PADDR_BITS, BITS_PER_LONG - 1);
> where
> #define PADDR_BITS  52
> 
> I guess PADDR_BITS can become unsigned or gain a cast

While generally converting constants to unsigned comes with a certain
risk, I think for this (and its siblings) this ought to be okay. As to
the alternative of a cast - before considering that, please consider
e.g. adding 0u (as we do elsewhere in the code base to deal with such
cases).

Jan



Re: [XEN PATCH] xen/types: address Rule 10.1 for macro BITS_TO_LONGS

2023-09-08 Thread Jan Beulich
On 08.09.2023 13:57, Jan Beulich wrote:
> On 08.09.2023 10:48, Nicola Vetrini wrote:
>> There is a build error due to -Werror because of a pointer comparison at 
>> line 469 of common/numa.c:
>> i = min(PADDR_BITS, BITS_PER_LONG - 1);
>> where
>> #define PADDR_BITS  52
>>
>> I guess PADDR_BITS can become unsigned or gain a cast
> 
> While generally converting constants to unsigned comes with a certain
> risk, I think for this (and its siblings) this ought to be okay. As to
> the alternative of a cast - before considering that, please consider
> e.g. adding 0u (as we do elsewhere in the code base to deal with such
> cases).

And just after sending I realized that this would still be disliked by
Misra's type system. (Much like then aiui the 1 above will need to
become 1u. Which is all pretty horrible.)

Jan



Re: [XEN PATCH] x86: change parameter name in {hap,shadow}_track_dirty_vram()

2023-09-08 Thread Jan Beulich
On 08.09.2023 11:10, Federico Serafini wrote:
> Make function declarations consistent with the corresponding
> definitions to address violations of MISRA C:2012 Rule 8.3.
> No functional change.
> 
> Signed-off-by: Federico Serafini 

Acked-by: Jan Beulich 





[ovmf test] 182740: all pass - PUSHED

2023-09-08 Thread osstest service owner
flight 182740 ovmf real [real]
http://logs.test-lab.xenproject.org/osstest/logs/182740/

Perfect :-)
All tests in this flight passed as required
version targeted for testing:
 ovmf ff7ddc02b273f9159ef46fdb67d99062f8e598d9
baseline version:
 ovmf 2ce5ae43c2166984d20341993c4b9dbb337aad79

Last test of basis   182732  2023-09-08 06:40:46 Z0 days
Testing same since   182740  2023-09-08 10:15:07 Z0 days1 attempts


People who touched revisions under test:
  Ard Biesheuvel 
  Jiewen Yao 
  Kun Qin 
  Pierre Gondois 

jobs:
 build-amd64-xsm  pass
 build-i386-xsm   pass
 build-amd64  pass
 build-i386   pass
 build-amd64-libvirt  pass
 build-i386-libvirt   pass
 build-amd64-pvopspass
 build-i386-pvops pass
 test-amd64-amd64-xl-qemuu-ovmf-amd64 pass
 test-amd64-i386-xl-qemuu-ovmf-amd64  pass



sg-report-flight on osstest.test-lab.xenproject.org
logs: /home/logs/logs
images: /home/logs/images

Logs, config files, etc. are available at
http://logs.test-lab.xenproject.org/osstest/logs

Explanation of these reports, and of osstest in general, is at
http://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=README.email;hb=master
http://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=README;hb=master

Test harness code can be found at
http://xenbits.xen.org/gitweb?p=osstest.git;a=summary


Pushing revision :

To xenbits.xen.org:/home/xen/git/osstest/ovmf.git
   2ce5ae43c2..ff7ddc02b2  ff7ddc02b273f9159ef46fdb67d99062f8e598d9 -> 
xen-tested-master



[libvirt test] 182728: tolerable FAIL - PUSHED

2023-09-08 Thread osstest service owner
flight 182728 libvirt real [real]
flight 182747 libvirt real-retest [real]
http://logs.test-lab.xenproject.org/osstest/logs/182728/
http://logs.test-lab.xenproject.org/osstest/logs/182747/

Failures :-/ but no regressions.

Tests which are failing intermittently (not blocking):
 test-amd64-i386-libvirt-pair 11 xen-install/dst_host fail pass in 182747-retest

Tests which did not succeed, but are not blocking:
 test-armhf-armhf-libvirt 16 saverestore-support-checkfail  like 182714
 test-armhf-armhf-libvirt-qcow2 15 saverestore-support-check   fail like 182714
 test-armhf-armhf-libvirt-raw 15 saverestore-support-checkfail  like 182714
 test-amd64-amd64-libvirt-xsm 15 migrate-support-checkfail   never pass
 test-amd64-i386-libvirt-xsm  15 migrate-support-checkfail   never pass
 test-amd64-i386-libvirt  15 migrate-support-checkfail   never pass
 test-amd64-amd64-libvirt 15 migrate-support-checkfail   never pass
 test-arm64-arm64-libvirt-xsm 15 migrate-support-checkfail   never pass
 test-arm64-arm64-libvirt-xsm 16 saverestore-support-checkfail   never pass
 test-arm64-arm64-libvirt 15 migrate-support-checkfail   never pass
 test-arm64-arm64-libvirt 16 saverestore-support-checkfail   never pass
 test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm 13 migrate-support-check 
fail never pass
 test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm 13 migrate-support-check 
fail never pass
 test-armhf-armhf-libvirt 15 migrate-support-checkfail   never pass
 test-arm64-arm64-libvirt-qcow2 14 migrate-support-checkfail never pass
 test-arm64-arm64-libvirt-qcow2 15 saverestore-support-checkfail never pass
 test-amd64-i386-libvirt-raw  14 migrate-support-checkfail   never pass
 test-amd64-amd64-libvirt-vhd 14 migrate-support-checkfail   never pass
 test-arm64-arm64-libvirt-raw 14 migrate-support-checkfail   never pass
 test-arm64-arm64-libvirt-raw 15 saverestore-support-checkfail   never pass
 test-armhf-armhf-libvirt-qcow2 14 migrate-support-checkfail never pass
 test-armhf-armhf-libvirt-raw 14 migrate-support-checkfail   never pass

version targeted for testing:
 libvirt  67c93cfae9312160de840d309bb3f5c36e5c9e9a
baseline version:
 libvirt  bfe53e9145cd5996a791c5caff0686572b850f82

Last test of basis   182714  2023-09-07 04:18:47 Z1 days
Testing same since   182728  2023-09-08 04:18:48 Z0 days1 attempts


People who touched revisions under test:
  Michal Privoznik 

jobs:
 build-amd64-xsm  pass
 build-arm64-xsm  pass
 build-i386-xsm   pass
 build-amd64  pass
 build-arm64  pass
 build-armhf  pass
 build-i386   pass
 build-amd64-libvirt  pass
 build-arm64-libvirt  pass
 build-armhf-libvirt  pass
 build-i386-libvirt   pass
 build-amd64-pvopspass
 build-arm64-pvopspass
 build-armhf-pvopspass
 build-i386-pvops pass
 test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm   pass
 test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsmpass
 test-amd64-amd64-libvirt-xsm pass
 test-arm64-arm64-libvirt-xsm pass
 test-amd64-i386-libvirt-xsm  pass
 test-amd64-amd64-libvirt pass
 test-arm64-arm64-libvirt pass
 test-armhf-armhf-libvirt pass
 test-amd64-i386-libvirt  pass
 test-amd64-amd64-libvirt-pairpass
 test-amd64-i386-libvirt-pair fail
 test-arm64-arm64-libvirt-qcow2   pass
 test-armhf-armhf-libvirt-qcow2   pass
 test-arm64-arm64-libvirt-raw pass
 test-armhf-armhf-libvirt-raw pass
 test-amd64-i386-libvirt-raw  pass
 test-amd64-amd64-libvirt-vhd pass



sg-report-flight on oss

Re: [XEN PATCH] xen/types: address Rule 10.1 for macro BITS_TO_LONGS

2023-09-08 Thread Nicola Vetrini

On 08/09/2023 13:59, Jan Beulich wrote:

On 08.09.2023 13:57, Jan Beulich wrote:

On 08.09.2023 10:48, Nicola Vetrini wrote:
There is a build error due to -Werror because of a pointer comparison 
at

line 469 of common/numa.c:
i = min(PADDR_BITS, BITS_PER_LONG - 1);
where
#define PADDR_BITS  52

I guess PADDR_BITS can become unsigned or gain a cast


While generally converting constants to unsigned comes with a certain
risk, I think for this (and its siblings) this ought to be okay. As to
the alternative of a cast - before considering that, please consider
e.g. adding 0u (as we do elsewhere in the code base to deal with such
cases).


And just after sending I realized that this would still be disliked by
Misra's type system. (Much like then aiui the 1 above will need to
become 1u. Which is all pretty horrible.)

Jan


I have a proposal: in our tests we enabled an ECLAIR configuration that 
allows to bypass the
constraint imposed by Rule 10.4 that warrants the 1U iff the value is 
constant and both types
can represent it correctly (in this case BITS_PER_LONG -1). This would 
allow using the proposed
solution and documenting why it's ok not to respect R10.4. What do you 
think?


--
Nicola Vetrini, BSc
Software Engineer, BUGSENG srl (https://bugseng.com)



Re: [XEN PATCH] xen/types: address Rule 10.1 for macro BITS_TO_LONGS

2023-09-08 Thread Nicola Vetrini

On 08/09/2023 16:53, Nicola Vetrini wrote:

On 08/09/2023 13:59, Jan Beulich wrote:

On 08.09.2023 13:57, Jan Beulich wrote:

On 08.09.2023 10:48, Nicola Vetrini wrote:
There is a build error due to -Werror because of a pointer 
comparison at

line 469 of common/numa.c:
i = min(PADDR_BITS, BITS_PER_LONG - 1);
where
#define PADDR_BITS  52

I guess PADDR_BITS can become unsigned or gain a cast


While generally converting constants to unsigned comes with a certain
risk, I think for this (and its siblings) this ought to be okay. As 
to

the alternative of a cast - before considering that, please consider
e.g. adding 0u (as we do elsewhere in the code base to deal with such
cases).


And just after sending I realized that this would still be disliked by
Misra's type system. (Much like then aiui the 1 above will need to
become 1u. Which is all pretty horrible.)

Jan


I have a proposal: in our tests we enabled an ECLAIR configuration
that allows to bypass the
constraint imposed by Rule 10.4 that warrants the 1U iff the value is
constant and both types
can represent it correctly (in this case BITS_PER_LONG -1). This would
allow using the proposed
solution and documenting why it's ok not to respect R10.4. What do you 
think?


And perhaps also use min_t instead of min, so that the typecheck can be 
avoided.


--
Nicola Vetrini, BSc
Software Engineer, BUGSENG srl (https://bugseng.com)



[ovmf test] 182753: all pass - PUSHED

2023-09-08 Thread osstest service owner
flight 182753 ovmf real [real]
http://logs.test-lab.xenproject.org/osstest/logs/182753/

Perfect :-)
All tests in this flight passed as required
version targeted for testing:
 ovmf b74f1f7ab5e956f58ae1771dc4e2a4b92bc51430
baseline version:
 ovmf ff7ddc02b273f9159ef46fdb67d99062f8e598d9

Last test of basis   182740  2023-09-08 10:15:07 Z0 days
Testing same since   182753  2023-09-08 13:43:09 Z0 days1 attempts


People who touched revisions under test:
  Kun Qin 

jobs:
 build-amd64-xsm  pass
 build-i386-xsm   pass
 build-amd64  pass
 build-i386   pass
 build-amd64-libvirt  pass
 build-i386-libvirt   pass
 build-amd64-pvopspass
 build-i386-pvops pass
 test-amd64-amd64-xl-qemuu-ovmf-amd64 pass
 test-amd64-i386-xl-qemuu-ovmf-amd64  pass



sg-report-flight on osstest.test-lab.xenproject.org
logs: /home/logs/logs
images: /home/logs/images

Logs, config files, etc. are available at
http://logs.test-lab.xenproject.org/osstest/logs

Explanation of these reports, and of osstest in general, is at
http://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=README.email;hb=master
http://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=README;hb=master

Test harness code can be found at
http://xenbits.xen.org/gitweb?p=osstest.git;a=summary


Pushing revision :

To xenbits.xen.org:/home/xen/git/osstest/ovmf.git
   ff7ddc02b2..b74f1f7ab5  b74f1f7ab5e956f58ae1771dc4e2a4b92bc51430 -> 
xen-tested-master



[linux-linus test] 182729: regressions - FAIL

2023-09-08 Thread osstest service owner
flight 182729 linux-linus real [real]
http://logs.test-lab.xenproject.org/osstest/logs/182729/

Regressions :-(

Tests which did not succeed and are blocking,
including tests which could not be run:
 test-amd64-amd64-xl-xsm   8 xen-boot fail REGR. vs. 182531
 test-amd64-amd64-xl-vhd   8 xen-boot fail REGR. vs. 182531
 test-amd64-amd64-xl-pvshim8 xen-boot fail REGR. vs. 182531
 test-amd64-amd64-freebsd12-amd64  8 xen-boot fail REGR. vs. 182531
 test-amd64-amd64-xl-pvhv2-intel  8 xen-boot  fail REGR. vs. 182531
 test-amd64-amd64-xl-qemuu-ws16-amd64  8 xen-boot fail REGR. vs. 182531
 test-amd64-amd64-xl-credit1   8 xen-boot fail REGR. vs. 182531
 test-amd64-amd64-libvirt-raw  8 xen-boot fail REGR. vs. 182531
 test-amd64-amd64-libvirt-xsm  8 xen-boot fail REGR. vs. 182531
 test-amd64-amd64-xl-shadow8 xen-boot fail REGR. vs. 182531
 test-amd64-amd64-xl-qemut-win7-amd64  8 xen-boot fail REGR. vs. 182531
 test-amd64-amd64-xl-qemuu-win7-amd64  8 xen-boot fail REGR. vs. 182531
 test-amd64-amd64-dom0pvh-xl-amd 14 guest-start   fail REGR. vs. 182531
 test-amd64-amd64-xl-qemut-debianhvm-i386-xsm  8 xen-boot fail REGR. vs. 182531
 test-amd64-amd64-xl-qemuu-debianhvm-amd64  8 xen-bootfail REGR. vs. 182531
 test-amd64-amd64-xl-multivcpu  8 xen-bootfail REGR. vs. 182531
 test-amd64-amd64-libvirt-qcow2  8 xen-boot   fail REGR. vs. 182531
 test-amd64-amd64-pair12 xen-boot/src_hostfail REGR. vs. 182531
 test-amd64-amd64-pair13 xen-boot/dst_hostfail REGR. vs. 182531
 test-amd64-amd64-qemuu-nested-intel  8 xen-boot  fail REGR. vs. 182531
 test-amd64-amd64-libvirt-pair 12 xen-boot/src_host   fail REGR. vs. 182531
 test-amd64-amd64-libvirt-pair 13 xen-boot/dst_host   fail REGR. vs. 182531
 test-amd64-amd64-xl-qemut-ws16-amd64  8 xen-boot fail REGR. vs. 182531
 test-amd64-amd64-qemuu-nested-amd  8 xen-bootfail REGR. vs. 182531
 test-amd64-amd64-xl-pvhv2-amd  8 xen-bootfail REGR. vs. 182531
 test-amd64-amd64-xl-qemuu-ovmf-amd64  8 xen-boot fail REGR. vs. 182531
 test-amd64-amd64-xl-qemuu-dmrestrict-amd64-dmrestrict 8 xen-boot fail REGR. 
vs. 182531
 test-amd64-amd64-xl-qemut-debianhvm-amd64  8 xen-bootfail REGR. vs. 182531
 test-amd64-amd64-dom0pvh-xl-intel 14 guest-start fail REGR. vs. 182531
 test-amd64-amd64-xl   8 xen-boot fail REGR. vs. 182531
 test-amd64-amd64-libvirt  8 xen-boot fail REGR. vs. 182531
 test-amd64-amd64-freebsd11-amd64  8 xen-boot fail REGR. vs. 182531
 test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm 8 xen-boot fail REGR. vs. 
182531
 test-amd64-amd64-xl-qemut-stubdom-debianhvm-amd64-xsm 8 xen-boot fail REGR. 
vs. 182531
 test-amd64-amd64-pygrub   8 xen-boot fail REGR. vs. 182531
 test-amd64-amd64-xl-credit2   8 xen-boot fail REGR. vs. 182531
 test-amd64-amd64-examine-uefi  8 reboot  fail REGR. vs. 182531
 test-amd64-amd64-examine-bios  8 reboot  fail REGR. vs. 182531
 test-amd64-coresched-amd64-xl  8 xen-bootfail REGR. vs. 182531
 test-amd64-amd64-xl-qemuu-debianhvm-i386-xsm  8 xen-boot fail REGR. vs. 182531
 test-amd64-amd64-examine  8 reboot   fail REGR. vs. 182531
 test-amd64-amd64-xl-qemuu-debianhvm-amd64-shadow 8 xen-boot fail REGR. vs. 
182531

Regressions which are regarded as allowable (not blocking):
 test-amd64-amd64-xl-rtds  8 xen-boot fail REGR. vs. 182531

Tests which did not succeed, but are not blocking:
 test-armhf-armhf-libvirt-qcow2 15 saverestore-support-check   fail like 182531
 test-armhf-armhf-libvirt 16 saverestore-support-checkfail  like 182531
 test-armhf-armhf-libvirt-raw 15 saverestore-support-checkfail  like 182531
 test-arm64-arm64-xl-thunderx 15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-thunderx 16 saverestore-support-checkfail   never pass
 test-arm64-arm64-xl-credit1  15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-credit1  16 saverestore-support-checkfail   never pass
 test-arm64-arm64-xl-xsm  15 migrate-support-checkfail   never pass
 test-arm64-arm64-libvirt-xsm 15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-xsm  16 saverestore-support-checkfail   never pass
 test-arm64-arm64-libvirt-xsm 16 saverestore-support-checkfail   never pass
 test-arm64-arm64-xl  15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-credit2  15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl  16 saverestore-support-checkfail   never pass
 test-arm64-arm64-xl-credit2  16 saverestore-support-checkfail   never pass
 test-armhf-armhf-x

[XEN PATCH v2 0/2] update gcov info for newer versions of gcc

2023-09-08 Thread Javi Merino
The gcov info changes with different versions of gcc.  This patch
series updates it so that we can capture coverage for xen built with
newer compilers.

This doesn't solve all the problems with coverage as Xen still crashes
when trying to reset/read coverage[0].  Still, it's a step forward.

[0] https://gitlab.com/xen-project/xen/-/issues/168

I have tested it with a workaround for the aforementioned bug
(commenting out freeing of the init sections) and the following gcc
versions:
  - gcc 4.8.5
  - gcc 4.9.4
  - gcc 6.5.0
  - gcc 7.5.0
  - gcc 8.5.0
  - gcc 9.5.0
  - gcc 10.5.0
  - gcc 11.4.0
  - gcc 12.3.0

Javi Merino (2):
  coverage: simplify the logic of choosing the number of gcov counters
depending on the gcc version
  coverage: update gcov info for newer versions of gcc

 xen/common/coverage/Makefile  |  6 +-
 xen/common/coverage/gcc_4_7.c | 39 ++-
 xen/common/coverage/gcc_4_9.c | 33 -
 xen/common/coverage/gcc_5.c   | 33 -
 xen/common/coverage/gcc_7.c   | 30 ---
 5 files changed, 30 insertions(+), 111 deletions(-)
 delete mode 100644 xen/common/coverage/gcc_4_9.c
 delete mode 100644 xen/common/coverage/gcc_5.c
 delete mode 100644 xen/common/coverage/gcc_7.c

-- 
2.41.0




[XEN PATCH v2 2/2] coverage: update gcov info for newer versions of gcc

2023-09-08 Thread Javi Merino
Shamelessly copy changes to gcov_info structures from linux so that we
can capture coverage for xen built with newer compilers.

Signed-off-by: Javi Merino 
---
 xen/common/coverage/gcc_4_7.c | 24 +---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/xen/common/coverage/gcc_4_7.c b/xen/common/coverage/gcc_4_7.c
index ddbc9f4bb0..8f6e287474 100644
--- a/xen/common/coverage/gcc_4_7.c
+++ b/xen/common/coverage/gcc_4_7.c
@@ -24,14 +24,23 @@
 #define GCOV_COUNTERS 9
 #elif GCC_VERSION >= 5 && GCC_VERSION < 7
 #define GCOV_COUNTERS 10
-#elif GCC_VERSION >= 7
+#elif GCC_VERSION >= 7 && GCC_VERSION < 10
 #define GCOV_COUNTERS 9
+#elif GCC_VERSION >= 10
+#define GCOV_COUNTERS 8
 #else
 #error "Wrong version of GCC used to compile gcov"
 #endif
 
 #define GCOV_TAG_FUNCTION_LENGTH3
 
+#if GCC_VERSION >= 12
+/* Since GCC 12.1, sizes are in BYTES and not in WORDS (4B). */
+#define GCOV_UNIT_SIZE 4
+#else
+#define GCOV_UNIT_SIZE 1
+#endif
+
 static struct gcov_info *gcov_info_head;
 
 /**
@@ -89,6 +98,10 @@ struct gcov_info {
 unsigned int version;
 struct gcov_info *next;
 unsigned int stamp;
+#if (GCC_VERSION >= 12)
+/*  GCC 12.1 introduced a checksum field */
+unsigned int checksum;
+#endif
 const char *filename;
 void (*merge[GCOV_COUNTERS])(gcov_type *, unsigned int);
 unsigned int n_functions;
@@ -161,13 +174,18 @@ size_t gcov_info_to_gcda(char *buffer, const struct 
gcov_info *info)
 pos += gcov_store_uint32(buffer, pos, info->version);
 pos += gcov_store_uint32(buffer, pos, info->stamp);
 
+#if (GCC_VERSION >= 12)
+/* Use zero as checksum of the compilation unit. */
+pos += gcov_store_uint32(buffer, pos, 0);
+#endif
+
 for ( fi_idx = 0; fi_idx < info->n_functions; fi_idx++ )
 {
 fi_ptr = info->functions[fi_idx];
 
 /* Function record. */
 pos += gcov_store_uint32(buffer, pos, GCOV_TAG_FUNCTION);
-pos += gcov_store_uint32(buffer, pos, GCOV_TAG_FUNCTION_LENGTH);
+pos += gcov_store_uint32(buffer, pos, GCOV_TAG_FUNCTION_LENGTH * 
GCOV_UNIT_SIZE);
 pos += gcov_store_uint32(buffer, pos, fi_ptr->ident);
 pos += gcov_store_uint32(buffer, pos, fi_ptr->lineno_checksum);
 pos += gcov_store_uint32(buffer, pos, fi_ptr->cfg_checksum);
@@ -182,7 +200,7 @@ size_t gcov_info_to_gcda(char *buffer, const struct 
gcov_info *info)
 /* Counter record. */
 pos += gcov_store_uint32(buffer, pos,
  GCOV_TAG_FOR_COUNTER(ct_idx));
-pos += gcov_store_uint32(buffer, pos, ci_ptr->num * 2);
+pos += gcov_store_uint32(buffer, pos, ci_ptr->num * 2 * 
GCOV_UNIT_SIZE);
 
 for ( cv_idx = 0; cv_idx < ci_ptr->num; cv_idx++ )
 pos += gcov_store_uint64(buffer, pos, ci_ptr->values[cv_idx]);
-- 
2.41.0




[XEN PATCH v2 1/2] coverage: simplify the logic of choosing the number of gcov counters depending on the gcc version

2023-09-08 Thread Javi Merino
The current structure of choosing the correct file based on the
compiler version makes us make 33 line files just to define a
constant.  The changes after gcc 4.7 are minimal, just the number of
counters.

Fold the changes in gcc_4_9.c, gcc_5.c and gcc_7.c into gcc_4_7.c to
remove a lot of the boilerplate and keep the logic of choosing the
GCOV_COUNTER in gcc_4_7.c.

Signed-off-by: Javi Merino 
---
 xen/common/coverage/Makefile  |  6 +-
 xen/common/coverage/gcc_4_7.c | 17 +
 xen/common/coverage/gcc_4_9.c | 33 -
 xen/common/coverage/gcc_5.c   | 33 -
 xen/common/coverage/gcc_7.c   | 30 --
 5 files changed, 10 insertions(+), 109 deletions(-)
 delete mode 100644 xen/common/coverage/gcc_4_9.c
 delete mode 100644 xen/common/coverage/gcc_5.c
 delete mode 100644 xen/common/coverage/gcc_7.c

diff --git a/xen/common/coverage/Makefile b/xen/common/coverage/Makefile
index 63f98c71d6..d729afc9c7 100644
--- a/xen/common/coverage/Makefile
+++ b/xen/common/coverage/Makefile
@@ -1,11 +1,7 @@
 obj-y += coverage.o
 ifneq ($(CONFIG_CC_IS_CLANG),y)
 obj-y += gcov_base.o gcov.o
-obj-y += $(call cc-ifversion,-lt,0407, \
-   gcc_3_4.o, $(call cc-ifversion,-lt,0409, \
-   gcc_4_7.o, $(call cc-ifversion,-lt,0500, \
-   gcc_4_9.o, $(call cc-ifversion,-lt,0700, \
-   gcc_5.o, gcc_7.o
+obj-y += $(call cc-ifversion,-lt,0407, gcc_3_4.o, gcc_4_7.o)
 else
 obj-y += llvm.o
 endif
diff --git a/xen/common/coverage/gcc_4_7.c b/xen/common/coverage/gcc_4_7.c
index 25b4a8bcdc..ddbc9f4bb0 100644
--- a/xen/common/coverage/gcc_4_7.c
+++ b/xen/common/coverage/gcc_4_7.c
@@ -18,15 +18,16 @@
 
 #include "gcov.h"
 
-/*
- * GCOV_COUNTERS will be defined if this file is included by other
- * source files.
- */
-#ifndef GCOV_COUNTERS
-# if !(GCC_VERSION >= 40700 && GCC_VERSION < 40900)
-#  error "Wrong version of GCC used to compile gcov"
-# endif
+#if (GCC_VERSION >= 40700 && GCC_VERSION < 40900)
 #define GCOV_COUNTERS 8
+#elif (GCC_VERSION >= 40900 && GCC_VERSION < 5)
+#define GCOV_COUNTERS 9
+#elif GCC_VERSION >= 5 && GCC_VERSION < 7
+#define GCOV_COUNTERS 10
+#elif GCC_VERSION >= 7
+#define GCOV_COUNTERS 9
+#else
+#error "Wrong version of GCC used to compile gcov"
 #endif
 
 #define GCOV_TAG_FUNCTION_LENGTH3
diff --git a/xen/common/coverage/gcc_4_9.c b/xen/common/coverage/gcc_4_9.c
deleted file mode 100644
index dcea961936..00
--- a/xen/common/coverage/gcc_4_9.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *  This code provides functions to handle gcc's profiling data format
- *  introduced with gcc 4.7.
- *
- *  For a better understanding, refer to gcc source:
- *  gcc/gcov-io.h
- *  libgcc/libgcov.c
- *
- *  Uses gcc-internal data definitions.
- *
- *  Imported from Linux and modified for Xen by
- *Wei Liu 
- */
-
-#include "gcov.h"
-
-#if !(GCC_VERSION >= 40900 && GCC_VERSION < 5)
-#error "Wrong version of GCC used to compile gcov"
-#endif
-
-#define GCOV_COUNTERS 9
-
-#include "gcc_4_7.c"
-
-/*
- * Local variables:
- * mode: C
- * c-file-style: "BSD"
- * c-basic-offset: 4
- * tab-width: 4
- * indent-tabs-mode: nil
- * End:
- */
diff --git a/xen/common/coverage/gcc_5.c b/xen/common/coverage/gcc_5.c
deleted file mode 100644
index 6e0d276f3b..00
--- a/xen/common/coverage/gcc_5.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *  This code provides functions to handle gcc's profiling data format
- *  introduced with gcc 5.
- *
- *  For a better understanding, refer to gcc source:
- *  gcc/gcov-io.h
- *  libgcc/libgcov.c
- *
- *  Uses gcc-internal data definitions.
- *
- *  Imported from Linux and modified for Xen by
- *Wei Liu 
- */
-
-#include "gcov.h"
-
-#if GCC_VERSION < 5 || GCC_VERSION >= 7
-#error "Wrong version of GCC used to compile gcov"
-#endif
-
-#define GCOV_COUNTERS 10
-
-#include "gcc_4_7.c"
-
-/*
- * Local variables:
- * mode: C
- * c-file-style: "BSD"
- * c-basic-offset: 4
- * tab-width: 4
- * indent-tabs-mode: nil
- * End:
- */
diff --git a/xen/common/coverage/gcc_7.c b/xen/common/coverage/gcc_7.c
deleted file mode 100644
index 3962eb4c76..00
--- a/xen/common/coverage/gcc_7.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- *  This code provides functions to handle gcc's profiling data format
- *  introduced with gcc 7.
- *
- *  For a better understanding, refer to gcc source:
- *  gcc/gcov-io.h
- *  libgcc/libgcov.c
- *
- *  Uses gcc-internal data definitions.
- */
-
-#include "gcov.h"
-
-#if GCC_VERSION < 7
-#error "Wrong version of GCC used to compile gcov"
-#endif
-
-#define GCOV_COUNTERS 9
-
-#include "gcc_4_7.c"
-
-/*
- * Local variables:
- * mode: C
- * c-file-style: "BSD"
- * c-basic-offset: 4
- * tab-width: 4
- * indent-tabs-mode: nil
- * End:
- */
-- 
2.41.0




Re: [PATCH v6 09/13] xen/arm: Extract MMU-specific MM code

2023-09-08 Thread Stefano Stabellini
On Fri, 8 Sep 2023, Henry Wang wrote:
> Hi Ayan,
> 
> > On Sep 7, 2023, at 19:34, Ayan Kumar Halder  wrote:
> > 
> > Hi Henry,
> > 
> >> +
> >> +extern mfn_t directmap_mfn_start, directmap_mfn_end;
> > 
> > As you are declaring them for MMU specific , you also need this change :-
> > 
> > diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
> > index 89ecb54be2..19b60c5d1b 100644
> > --- a/xen/arch/arm/setup.c
> > +++ b/xen/arch/arm/setup.c
> > @@ -670,7 +670,7 @@ void __init populate_boot_allocator(void)
> > 
> >  s = bootinfo.reserved_mem.bank[i].start;
> >  e = s + bootinfo.reserved_mem.bank[i].size;
> > -#ifdef CONFIG_ARM_32
> > +#if (CONFIG_ARM_32 && CONFIG_MMU)
> >  /* Avoid the xenheap, note that the xenheap cannot across a 
> > bank */
> >  if ( s <= mfn_to_maddr(directmap_mfn_start) &&
> >   e >= mfn_to_maddr(directmap_mfn_end) )
> > @@ -708,7 +708,7 @@ void __init populate_boot_allocator(void)
> >  if ( e > bank_end )
> >  e = bank_end;
> > 
> > -#ifdef CONFIG_ARM_32
> > +#if (CONFIG_ARM_32 && CONFIG_MMU)
> >  /* Avoid the xenheap */
> >  if ( s < mfn_to_maddr(directmap_mfn_end) &&
> >   mfn_to_maddr(directmap_mfn_start) < e )
> > 
> > So that directmap_mfn_end and directmap_mfn_start is used only when MMU is 
> > enabled.
> 
> I am not 100% sure on this, because currently there is no MPU code at
> all, indicating all setup.c is MMU specific. In this case adding “&& 
> CONFIG_MMU”
> seems a little bit redundant to me. But I agree you made a point and it is 
> correct
> that when the MPU code is in, these “directmap” part should be gated with
> CONFIG_MMU (or maybe split the code between arm32/arm64 to different helpers
> to avoid #ifdef). Hence I would prefer doing these change when the MPU code 
> is added.
> 
> Let’s see what maintainers will say. I am happy to do the change once we have
> an agreement.

It might be wiser to add && CONFIG_MMU when the MPU code is added in
case we decide to move it / shape it differently.

Re: [PATCH v2] acpi/processor: sanitize _PDC buffer bits when running as Xen dom0

2023-09-08 Thread Jason Andryuk
On Thu, Sep 7, 2023 at 9:20 AM Wilczynski, Michal
 wrote:
>
>
> Hi,
>
> On 9/6/2023 8:21 PM, Jason Andryuk wrote:
> > From: Roger Pau Monne 
> >
> > The Processor _PDC buffer bits notify ACPI of the OS capabilities, and
> > so ACPI can adjust the return of other Processor methods taking the OS
> > capabilities into account.
>
> _PDC method is deprecated for this purpose, since 2018, and is dropped from
> spec since 6.5
>
> We made the switch in linux since 6.6:
> 95272641338a ("ACPI: processor: Use _OSC to convey OSPM processor support 
> information")

Thanks for the heads up, Michal.  The patch pre-dated 6.6 and I based
this one off of 6.5.

> >
> > When Linux is running as a Xen dom0, it's the hypervisor the entity
> > in charge of processor power management, and hence Xen needs to make
> > sure the capabilities reported in the _PDC buffer match the
> > capabilities of the driver in Xen.
>
> So I guess you would need to sanitize buffer passed to _OSC method instead ?

I think I'll modify the capabilities in arch_acpi_set_proc_cap_bits()
and that will handle both _OSC and the _PDC fallback.

Regards,
Jason



[qemu-mainline test] 182739: regressions - FAIL

2023-09-08 Thread osstest service owner
flight 182739 qemu-mainline real [real]
http://logs.test-lab.xenproject.org/osstest/logs/182739/

Regressions :-(

Tests which did not succeed and are blocking,
including tests which could not be run:
 build-arm64-xsm   6 xen-buildfail REGR. vs. 182707
 build-i3866 xen-buildfail REGR. vs. 182707
 build-arm64   6 xen-buildfail REGR. vs. 182707
 build-amd64-xsm   6 xen-buildfail REGR. vs. 182707
 build-amd64   6 xen-buildfail REGR. vs. 182707
 build-i386-xsm6 xen-buildfail REGR. vs. 182707
 build-armhf   6 xen-buildfail REGR. vs. 182707

Tests which did not succeed, but are not blocking:
 test-amd64-i386-xl-qemuu-debianhvm-amd64-shadow  1 build-check(1)  blocked n/a
 test-amd64-i386-xl-qemuu-debianhvm-i386-xsm  1 build-check(1)  blocked n/a
 test-amd64-i386-xl-qemuu-dmrestrict-amd64-dmrestrict 1 build-check(1) blocked 
n/a
 test-amd64-i386-xl-qemuu-ovmf-amd64  1 build-check(1)  blocked n/a
 test-amd64-i386-xl-qemuu-win7-amd64  1 build-check(1)  blocked n/a
 test-amd64-i386-xl-qemuu-ws16-amd64  1 build-check(1)  blocked n/a
 test-amd64-i386-xl-shadow 1 build-check(1)   blocked  n/a
 test-amd64-i386-xl-vhd1 build-check(1)   blocked  n/a
 test-amd64-i386-xl-xsm1 build-check(1)   blocked  n/a
 test-arm64-arm64-libvirt-raw  1 build-check(1)   blocked  n/a
 test-arm64-arm64-libvirt-xsm  1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl   1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl-credit1   1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl-credit2   1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl-thunderx  1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl-vhd   1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl-xsm   1 build-check(1)   blocked  n/a
 test-armhf-armhf-libvirt  1 build-check(1)   blocked  n/a
 test-armhf-armhf-libvirt-qcow2  1 build-check(1)   blocked  n/a
 test-armhf-armhf-libvirt-raw  1 build-check(1)   blocked  n/a
 test-armhf-armhf-xl   1 build-check(1)   blocked  n/a
 test-armhf-armhf-xl-arndale   1 build-check(1)   blocked  n/a
 test-armhf-armhf-xl-multivcpu  1 build-check(1)   blocked  n/a
 test-armhf-armhf-xl-rtds  1 build-check(1)   blocked  n/a
 test-armhf-armhf-xl-vhd   1 build-check(1)   blocked  n/a
 test-amd64-i386-qemuu-rhel6hvm-amd  1 build-check(1)   blocked n/a
 test-amd64-i386-pair  1 build-check(1)   blocked  n/a
 test-amd64-i386-libvirt-xsm   1 build-check(1)   blocked  n/a
 test-amd64-i386-libvirt-raw   1 build-check(1)   blocked  n/a
 test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm 1 build-check(1) blocked n/a
 test-amd64-i386-libvirt-pair  1 build-check(1)   blocked  n/a
 test-amd64-i386-libvirt   1 build-check(1)   blocked  n/a
 test-amd64-i386-freebsd10-i386  1 build-check(1)   blocked  n/a
 test-amd64-i386-freebsd10-amd64  1 build-check(1)   blocked  n/a
 test-amd64-coresched-i386-xl  1 build-check(1)   blocked  n/a
 test-amd64-coresched-amd64-xl  1 build-check(1)   blocked  n/a
 test-amd64-amd64-xl-xsm   1 build-check(1)   blocked  n/a
 build-amd64-libvirt   1 build-check(1)   blocked  n/a
 test-amd64-amd64-xl-shadow1 build-check(1)   blocked  n/a
 test-amd64-amd64-xl-rtds  1 build-check(1)   blocked  n/a
 build-arm64-libvirt   1 build-check(1)   blocked  n/a
 test-amd64-amd64-xl-qemuu-ws16-amd64  1 build-check(1) blocked n/a
 test-amd64-amd64-xl-qemuu-win7-amd64  1 build-check(1) blocked n/a
 test-amd64-amd64-xl-qemuu-ovmf-amd64  1 build-check(1) blocked n/a
 build-armhf-libvirt   1 build-check(1)   blocked  n/a
 test-amd64-amd64-xl-qemuu-dmrestrict-amd64-dmrestrict 1 build-check(1) blocked 
n/a
 build-i386-libvirt1 build-check(1)   blocked  n/a
 test-amd64-amd64-xl-qemuu-debianhvm-i386-xsm  1 build-check(1) blocked n/a
 test-amd64-amd64-dom0pvh-xl-amd  1 build-check(1)   blocked  n/a
 test-amd64-amd64-xl-qemuu-debianhvm-amd64-shadow  1 build-check(1) blocked n/a
 test-amd64-amd64-dom0pvh-xl-intel  1 build-check(1)   blocked  n/a
 test-amd64-amd64-xl-qemuu-debianhvm-amd64  1 build-check(1)blocked n/a
 test-amd64-amd64-libvirt  1 build-check(1)   blocked  n/a
 test-amd64-amd64-libvirt-pair  1 build-check(1)   blocked  n/a
 test-amd64-amd64-libvirt-qemuu-de

Re: [XEN PATCH 1/3] docs/misra: add documentation skeleton for MISRA C:2012 Dir 4.1

2023-09-08 Thread Stefano Stabellini
On Fri, 8 Sep 2023, Jan Beulich wrote:
> On 08.09.2023 02:20, Stefano Stabellini wrote:
> > On Fri, 1 Sep 2023, Nicola Vetrini wrote:
> >> +Documentation for MISRA C:2012 Dir 4.1: read from uninitialized allocated 
> >> object
> >> +
> >> +
> >> +To be written.
> >> +Example:
> >> +The code does not use dynamically allocated storage.
> > 
> > We do use dynamically allocated storage with xzalloc but xzalloc
> > initializes the object to zero
> 
> Just at the example of this: I'm not sure in how far the examples given
> were actually meant to (remotely) apply to our code base.

I thought they were generic examples as Nicola later confirmed. But
surprisingly many of them apply to our code base. I tried to highlight
the ones that are obviously wrong.


> As to your reply - there's also xmalloc() which doesn't, and the page
> allocator, and other more specialized ones.

Yes my reply was wrong in this case: I vastly underestimated the amount
of callers to xmalloc() that we have (and I grepped wrongly).

I think we should say instead:

The amount of dynamically allocated objects is limited at runtime in
static configurations. We make sure to initialize dynamically allocated
objects before reading them, and we utilize static analysis tools to
help check for that.



[ovmf test] 182760: all pass - PUSHED

2023-09-08 Thread osstest service owner
flight 182760 ovmf real [real]
http://logs.test-lab.xenproject.org/osstest/logs/182760/

Perfect :-)
All tests in this flight passed as required
version targeted for testing:
 ovmf 493a375eef584be2beaaa3d418a8e7ff333c5468
baseline version:
 ovmf b74f1f7ab5e956f58ae1771dc4e2a4b92bc51430

Last test of basis   182753  2023-09-08 13:43:09 Z0 days
Testing same since   182760  2023-09-08 15:40:41 Z0 days1 attempts


People who touched revisions under test:
  Michael Kubacki 

jobs:
 build-amd64-xsm  pass
 build-i386-xsm   pass
 build-amd64  pass
 build-i386   pass
 build-amd64-libvirt  pass
 build-i386-libvirt   pass
 build-amd64-pvopspass
 build-i386-pvops pass
 test-amd64-amd64-xl-qemuu-ovmf-amd64 pass
 test-amd64-i386-xl-qemuu-ovmf-amd64  pass



sg-report-flight on osstest.test-lab.xenproject.org
logs: /home/logs/logs
images: /home/logs/images

Logs, config files, etc. are available at
http://logs.test-lab.xenproject.org/osstest/logs

Explanation of these reports, and of osstest in general, is at
http://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=README.email;hb=master
http://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=README;hb=master

Test harness code can be found at
http://xenbits.xen.org/gitweb?p=osstest.git;a=summary


Pushing revision :

To xenbits.xen.org:/home/xen/git/osstest/ovmf.git
   b74f1f7ab5..493a375eef  493a375eef584be2beaaa3d418a8e7ff333c5468 -> 
xen-tested-master



Re: [PATCH v2 1/2] automation: Switch ppc64le tests to PowerNV machine type

2023-09-08 Thread Shawn Anastasio
On 9/6/23 7:41 PM, Stefano Stabellini wrote:
> On Wed, 6 Sep 2023, Shawn Anastasio wrote:
>> Run ppc64le tests with the PowerNV machine type (bare metal) instead of
>> the paravirtualized pseries machine. This requires a more modern version
>> of QEMU than is present in debian bullseye's repository, so update the
>> dockerfile to build QEMU from source.
>>
>> Support for booting on pseries was broken by 74b725a64d80 ('xen/ppc:
>> Implement initial Radix MMU support') which resulted in CI failures. In
>> preparation for removing pseries support entirely, switch the CI
>> infrastructure to the PowerNV machine type.
>>
>> Signed-off-by: Shawn Anastasio 
>> ---
>>  .../build/debian/bullseye-ppc64le.dockerfile  | 37 ++-
>>  automation/gitlab-ci/test.yaml|  2 +-
>>  2 files changed, 36 insertions(+), 3 deletions(-)
>>
>> diff --git a/automation/build/debian/bullseye-ppc64le.dockerfile 
>> b/automation/build/debian/bullseye-ppc64le.dockerfile
>> index 8fad26e903..15827bbcf4 100644
>> --- a/automation/build/debian/bullseye-ppc64le.dockerfile
>> +++ b/automation/build/debian/bullseye-ppc64le.dockerfile
>> @@ -1,4 +1,36 @@
>> +FROM debian:bullseye-slim AS builder
>> +
>> +ENV DEBIAN_FRONTEND=noninteractive
>> +ENV QEMU_TAG=stable-8.1
>> +ENV USER root
>> +
>> +# dependencies for qemu build
>> +RUN apt-get update && \
>> +apt-get --quiet --yes install \
>> +git \
>> +build-essential \
>> +python3-minimal \
>> +python3-elementpath \
>> +python3-pip \
>> +ninja-build \
>> +libglib2.0-dev \
>> +libpixman-1-dev
>> +
>> +RUN mkdir /build
>> +WORKDIR /build
>> +
>> +# QEMU build from git
>> +RUN git clone --depth 1 --branch "${QEMU_TAG}" https://github.com/qemu/qemu 
>> && \
>> +mkdir qemu/build && \
>> +cd qemu/build && \
>> +../configure --target-list=ppc64-softmmu && \
>> +ninja && \
>> +ninja install
> 
> It is totally find to build your QEMU but please use a test-artifact
> instead, see automation/tests-artifacts/qemu-system-aarch64/ and
> qemu-system-aarch64-6.0.0-arm64-export as an example.

Thanks for letting me know -- I've submitted a v3 that uses this
technique to build the QEMU binary based on the aarch64 example you
provided.

Shawn



Re: [PATCH v2 1/2] automation: Switch ppc64le tests to PowerNV machine type

2023-09-08 Thread Stefano Stabellini
On Fri, 8 Sep 2023, Shawn Anastasio wrote:
> On 9/6/23 7:41 PM, Stefano Stabellini wrote:
> > On Wed, 6 Sep 2023, Shawn Anastasio wrote:
> >> Run ppc64le tests with the PowerNV machine type (bare metal) instead of
> >> the paravirtualized pseries machine. This requires a more modern version
> >> of QEMU than is present in debian bullseye's repository, so update the
> >> dockerfile to build QEMU from source.
> >>
> >> Support for booting on pseries was broken by 74b725a64d80 ('xen/ppc:
> >> Implement initial Radix MMU support') which resulted in CI failures. In
> >> preparation for removing pseries support entirely, switch the CI
> >> infrastructure to the PowerNV machine type.
> >>
> >> Signed-off-by: Shawn Anastasio 
> >> ---
> >>  .../build/debian/bullseye-ppc64le.dockerfile  | 37 ++-
> >>  automation/gitlab-ci/test.yaml|  2 +-
> >>  2 files changed, 36 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/automation/build/debian/bullseye-ppc64le.dockerfile 
> >> b/automation/build/debian/bullseye-ppc64le.dockerfile
> >> index 8fad26e903..15827bbcf4 100644
> >> --- a/automation/build/debian/bullseye-ppc64le.dockerfile
> >> +++ b/automation/build/debian/bullseye-ppc64le.dockerfile
> >> @@ -1,4 +1,36 @@
> >> +FROM debian:bullseye-slim AS builder
> >> +
> >> +ENV DEBIAN_FRONTEND=noninteractive
> >> +ENV QEMU_TAG=stable-8.1
> >> +ENV USER root
> >> +
> >> +# dependencies for qemu build
> >> +RUN apt-get update && \
> >> +apt-get --quiet --yes install \
> >> +git \
> >> +build-essential \
> >> +python3-minimal \
> >> +python3-elementpath \
> >> +python3-pip \
> >> +ninja-build \
> >> +libglib2.0-dev \
> >> +libpixman-1-dev
> >> +
> >> +RUN mkdir /build
> >> +WORKDIR /build
> >> +
> >> +# QEMU build from git
> >> +RUN git clone --depth 1 --branch "${QEMU_TAG}" 
> >> https://github.com/qemu/qemu && \
> >> +mkdir qemu/build && \
> >> +cd qemu/build && \
> >> +../configure --target-list=ppc64-softmmu && \
> >> +ninja && \
> >> +ninja install
> > 
> > It is totally find to build your QEMU but please use a test-artifact
> > instead, see automation/tests-artifacts/qemu-system-aarch64/ and
> > qemu-system-aarch64-6.0.0-arm64-export as an example.
> 
> Thanks for letting me know -- I've submitted a v3 that uses this
> technique to build the QEMU binary based on the aarch64 example you
> provided.

I have already committed v3 :-)



Re: [XEN PATCH] xen/types: address Rule 10.1 for macro BITS_TO_LONGS

2023-09-08 Thread Stefano Stabellini
On Fri, 8 Sep 2023, Nicola Vetrini wrote:
> On 08/09/2023 13:59, Jan Beulich wrote:
> > On 08.09.2023 13:57, Jan Beulich wrote:
> > > On 08.09.2023 10:48, Nicola Vetrini wrote:
> > > > There is a build error due to -Werror because of a pointer comparison at
> > > > line 469 of common/numa.c:
> > > > i = min(PADDR_BITS, BITS_PER_LONG - 1);
> > > > where
> > > > #define PADDR_BITS  52
> > > > 
> > > > I guess PADDR_BITS can become unsigned or gain a cast
> > > 
> > > While generally converting constants to unsigned comes with a certain
> > > risk, I think for this (and its siblings) this ought to be okay. As to
> > > the alternative of a cast - before considering that, please consider
> > > e.g. adding 0u (as we do elsewhere in the code base to deal with such
> > > cases).
> > 
> > And just after sending I realized that this would still be disliked by
> > Misra's type system. (Much like then aiui the 1 above will need to
> > become 1u. Which is all pretty horrible.)
> > 
> > Jan
> 
> I have a proposal: in our tests we enabled an ECLAIR configuration that allows
> to bypass the
> constraint imposed by Rule 10.4 that warrants the 1U iff the value is constant
> and both types
> can represent it correctly (in this case BITS_PER_LONG -1). This would allow
> using the proposed
> solution and documenting why it's ok not to respect R10.4. What do you think?

I think that would be OK. I think we would want to document this in
rules.rst. Please send a patch.



[ovmf test] 182772: all pass - PUSHED

2023-09-08 Thread osstest service owner
flight 182772 ovmf real [real]
http://logs.test-lab.xenproject.org/osstest/logs/182772/

Perfect :-)
All tests in this flight passed as required
version targeted for testing:
 ovmf 28a74d7ab22a33e3915eb747879d58797718f6f2
baseline version:
 ovmf 493a375eef584be2beaaa3d418a8e7ff333c5468

Last test of basis   182760  2023-09-08 15:40:41 Z0 days
Testing same since   182772  2023-09-08 18:19:00 Z0 days1 attempts


People who touched revisions under test:
  Corvin Köhne 

jobs:
 build-amd64-xsm  pass
 build-i386-xsm   pass
 build-amd64  pass
 build-i386   pass
 build-amd64-libvirt  pass
 build-i386-libvirt   pass
 build-amd64-pvopspass
 build-i386-pvops pass
 test-amd64-amd64-xl-qemuu-ovmf-amd64 pass
 test-amd64-i386-xl-qemuu-ovmf-amd64  pass



sg-report-flight on osstest.test-lab.xenproject.org
logs: /home/logs/logs
images: /home/logs/images

Logs, config files, etc. are available at
http://logs.test-lab.xenproject.org/osstest/logs

Explanation of these reports, and of osstest in general, is at
http://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=README.email;hb=master
http://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=README;hb=master

Test harness code can be found at
http://xenbits.xen.org/gitweb?p=osstest.git;a=summary


Pushing revision :

To xenbits.xen.org:/home/xen/git/osstest/ovmf.git
   493a375eef..28a74d7ab2  28a74d7ab22a33e3915eb747879d58797718f6f2 -> 
xen-tested-master



Re: [PATCH v2] docs/misra: add 14.3

2023-09-08 Thread Stefano Stabellini
On Fri, 8 Sep 2023, Nicola Vetrini wrote:
> On 07/09/2023 23:45, Stefano Stabellini wrote:
> > On Thu, 7 Sep 2023, Jan Beulich wrote:
> > > On 07.09.2023 03:22, Stefano Stabellini wrote:
> > > > @@ -385,6 +386,17 @@ maintainers if you want to suggest a change.
> > > >   - A loop counter shall not have essentially floating type
> > > >   -
> > > >
> > > > +   * - `Rule 14.3
> > > `_
> > > > + - Required
> > > > + - Controlling expressions shall not be invariant
> > > > + - Due to the extensive usage of IS_ENABLED, sizeof compile-time
> > > > +   checks, and other constructs that are detected as errors by
> > > MISRA
> > > > +   C scanners, managing the configuration of a MISRA C scanner for
> > > > +   this rule would be unmanageable. Thus, this rule is adopted with
> > > > +   a project-wide deviation on if ?: and switch statements.
> > > 
> > > Do we want to go as far as permitting this uniformly for all switch()? In
> > > my earlier reply I had included sizeof() for a reason.
> > 
> > I agree with you that it would be better to restrict it to only some
> > switch uses, rather than all of them.
> > 
> > But if we are going to restrict the deviation to switch(sizeof()), which
> > I think is a good idea and I am in favor, wouldn't it be better to
> > handle these cases as individual deviations? E.g. docs/misra/safe.json?
> > I am assuming there are only few cases like that and adding it here
> > makes the rule more complicated.
> > 
> > I am happy either way but I wanted to provide that as an option.
> > 
> > 
> 
> It's also worth considering the magnitude of required SAF comments when making
> this choice.
> In this case, from a cursory glance at the present violations, it seems that
> there are maybe a
> handful of switches inside macros, so they shouldn't be problematic to deal
> with.

That's what I thought as well and why I suggested to only deal with them
in safe.json. However, it doesn't cost us anything to be extra clear, so
I'll send an updated patch with extra clarity.



[PATCH v3] docs/misra: add 14.3

2023-09-08 Thread Stefano Stabellini
From: Stefano Stabellini 

Add 14.3, with project-wide deviations.

Also take the opportunity to clarify that parameters of function pointer
types are expected to have names (Rule 8.2).

Signed-off-by: Stefano Stabellini 
---
Changes in v3:
- add ,
- add switch(sizeof(...)) and switch(offsetof(...))
---
 docs/misra/rules.rst | 15 ++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
index 34916e266a..ac76e20a9c 100644
--- a/docs/misra/rules.rst
+++ b/docs/misra/rules.rst
@@ -234,7 +234,8 @@ maintainers if you want to suggest a change.
* - `Rule 8.2 
`_
  - Required
  - Function types shall be in prototype form with named parameters
- -
+ - Clarification: both function and function pointers types shall
+   have named parameters.
 
* - `Rule 8.3 
`_
  - Required
@@ -385,6 +386,18 @@ maintainers if you want to suggest a change.
  - A loop counter shall not have essentially floating type
  -
 
+   * - `Rule 14.3 
`_
+ - Required
+ - Controlling expressions shall not be invariant
+ - Due to the extensive usage of IS_ENABLED, sizeof compile-time
+   checks, and other constructs that are detected as errors by MISRA
+   C scanners, managing the configuration of a MISRA C scanner for
+   this rule would be unmanageable. Thus, this rule is adopted with
+   a project-wide deviation on if, ?:, switch(sizeof(...)), and
+   switch(offsetof(...)) statements.
+
+   while(0) and while(1) and alike are allowed.
+
* - `Rule 16.7 
`_
  - Required
  - A switch-expression shall not have essentially Boolean type
-- 
2.25.1




Re: [PATCH v3 3/5] xen/ppc: Define minimal stub headers required for full build

2023-09-08 Thread Shawn Anastasio
On 9/5/23 10:52 AM, Jan Beulich wrote:
> On 01.09.2023 20:25, Shawn Anastasio wrote:
>> --- /dev/null
>> +++ b/xen/arch/ppc/include/asm/device.h
>> @@ -0,0 +1,53 @@
>> +/* SPDX-License-Identifier: GPL-2.0-only */
>> +#ifndef __ASM_PPC_DEVICE_H__
>> +#define __ASM_PPC_DEVICE_H__
>> +
>> +enum device_type
>> +{
>> +DEV_DT,
>> +DEV_PCI,
>> +};
>> +
>> +struct device {
>> +enum device_type type;
>> +#ifdef CONFIG_HAS_DEVICE_TREE
>> +struct dt_device_node *of_node; /* Used by drivers imported from Linux 
>> */
>> +#endif
>> +};
>> +
>> +enum device_class
>> +{
>> +DEVICE_SERIAL,
>> +DEVICE_IOMMU,
>> +DEVICE_PCI_HOSTBRIDGE,
>> +/* Use for error */
>> +DEVICE_UNKNOWN,
>> +};
>> +
>> +struct device_desc {
>> +/* Device name */
>> +const char *name;
>> +/* Device class */
>> +enum device_class class;
>> +/* List of devices supported by this driver */
>> +const struct dt_device_match *dt_match;
>> +/*
>> + * Device initialization.
>> + *
>> + * -EAGAIN is used to indicate that device probing is deferred.
>> + */
>> +int (*init)(struct dt_device_node *dev, const void *data);
>> +};
>> +
>> +typedef struct device device_t;
>> +
>> +#define DT_DEVICE_START(_name, _namestr, _class)\
> 
> Nit: Underscore-prefixed macro parameter names again.
>

Will fix.

>> --- a/xen/arch/ppc/include/asm/mm.h
>> +++ b/xen/arch/ppc/include/asm/mm.h
>> @@ -1,10 +1,25 @@
>> +/* SPDX-License-Identifier: GPL-2.0-only */
>>  #ifndef _ASM_PPC_MM_H
>>  #define _ASM_PPC_MM_H
>>
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>>  #include 
>> +#include 
>> +
>> +void setup_initial_pagetables(void);
>>
>>  #define pfn_to_paddr(pfn) ((paddr_t)(pfn) << PAGE_SHIFT)
>>  #define paddr_to_pfn(pa)  ((unsigned long)((pa) >> PAGE_SHIFT))
>> +#define paddr_to_pdx(pa)mfn_to_pdx(maddr_to_mfn(pa))
>> +#define gfn_to_gaddr(gfn)   pfn_to_paddr(gfn_x(gfn))
>> +#define gaddr_to_gfn(ga)_gfn(paddr_to_pfn(ga))
>> +#define mfn_to_maddr(mfn)   pfn_to_paddr(mfn_x(mfn))
>> +#define maddr_to_mfn(ma)_mfn(paddr_to_pfn(ma))
>> +#define vmap_to_mfn(va) maddr_to_mfn(virt_to_maddr((vaddr_t)va))
>> +#define vmap_to_page(va)mfn_to_page(vmap_to_mfn(va))
>>
>>  #define virt_to_maddr(va) ((paddr_t)((vaddr_t)(va) & PADDR_MASK))
>>  #define maddr_to_virt(pa) ((void *)((paddr_t)(pa) | XEN_VIRT_START))
> 
> Is it intentional that the additions don't align, padding-wise, with the
> surrounding #define-s?
>

No -- good catch. I'll adjust the padding to line up properly.

>> @@ -13,6 +28,237 @@
>>  #define __pa(x) (virt_to_maddr(x))
>>  #define __va(x) (maddr_to_virt(x))
>>
>> -void setup_initial_pagetables(void);
>> +/* Convert between Xen-heap virtual addresses and machine frame numbers. */
>> +#define __virt_to_mfn(va) (virt_to_maddr(va) >> PAGE_SHIFT)
>> +#define __mfn_to_virt(mfn) (maddr_to_virt((paddr_t)(mfn) << PAGE_SHIFT))
>> +
>> +/* Convert between Xen-heap virtual addresses and page-info structures. */
>> +static inline struct page_info *virt_to_page(const void *v)
>> +{
>> +BUG_ON("unimplemented");
>> +return NULL;
>> +}
>> +
>> +/*
>> + * We define non-underscored wrappers for above conversion functions.
>> + * These are overriden in various source files while underscored version
>> + * remain intact.
>> + */
>> +#define virt_to_mfn(va) __virt_to_mfn(va)
>> +#define mfn_to_virt(mfn)__mfn_to_virt(mfn)
> 
> Is the comment really applicable? The only non-arch-specific file still
> doing so is xenoprof.c, and I'm not sure you mean to support xenoprof
> on PPC. PPC-specific files would better be introduced in a type-safe way
> right from the beginning.
>

To be clear, you're suggesting that I define virt_to_mfn and mfn_to_virt
to operate on the type-safe mfn_t wrapper? When doing this,
xen/include/xen/domain_page.h:63 fails to build, since it seems to
assume that these macros do not use the type-safe mfn_t:

  static inline void *map_domain_page_global(mfn_t mfn)
  {
  return mfn_to_virt(mfn_x(mfn));
  }

If the comment is no longer accurate I can drop it, but there definitely
seems to be an assumption in the codebase that these macros operate on
raw unsigned longs rather than mfn_t.

>> +#define PG_shift(idx)   (BITS_PER_LONG - (idx))
>> +#define PG_mask(x, idx) (x ## UL << PG_shift(idx))
>> +
>> +#define PGT_none  PG_mask(0, 1)  /* no special uses of this page   
>> */
>> +#define PGT_writable_page PG_mask(1, 1)  /* has writable mappings? 
>> */
>> +#define PGT_type_mask PG_mask(1, 1)  /* Bits 31 or 63. 
>> */
>> +
>> + /* 2-bit count of uses of this frame as its current type. */
>> +#define PGT_count_maskPG_mask(3, 3)
>> +
>> +/* Cleared when the owning guest 'frees' this page. */
>> +#define _PGC_allocatedPG_shift(1)
>> +#define PGC_allocated PG_mask(1, 1)
>> +/* Page is Xen heap? */
>> +#define _PGC_xen_heap PG_shift(2)
>> +#define PGC_xen_heap  PG_

Re: [PATCH v6 00/13] xen/arm: Split MMU code as the prepration of MPU work

2023-09-08 Thread Stefano Stabellini
I committed patches 1-5

On Mon, 28 Aug 2023, Henry Wang wrote:
> Based on the discussion in the Xen Summit [1], sending this series out after
> addressing the comments in v5 [2] as the preparation work to add MPU support.
> The series passed the GitLab CI check in [3].
> 
> Mostly code movement and function folding, with some of Kconfig and build
> system (mainly Makefiles) adjustment.
> 
> This series is based on:
> ec272d8d4c CI: Always move the bisect build log back
> 
> [1] 
> https://lore.kernel.org/xen-devel/as8pr08mb799122f8b0cb841ded64f48192...@as8pr08mb7991.eurprd08.prod.outlook.com/
> [2] 
> https://lore.kernel.org/xen-devel/20230814042536.878720-1-henry.w...@arm.com/
> [3] https://gitlab.com/xen-project/people/henryw/xen/-/pipelines/982592897
> 
> Henry Wang (9):
>   xen/arm: Introduce CONFIG_MMU Kconfig option
>   xen/arm64: Split and move MMU-specific head.S to mmu/head.S
>   xen/arm64: Fold setup_fixmap() to create_page_tables()
>   xen/arm: Split page table related code to mmu/pt.c
>   xen/arm: Split MMU system SMP MM bringup code to mmu/smpboot.c
>   xen/arm: Fold mmu_init_secondary_cpu() to head.S
>   xen/arm: Extract MMU-specific MM code
>   xen/arm: Split MMU-specific setup_mm() and related code out
>   xen/arm: Fold pmap and fixmap into MMU system
> 
> Penny Zheng (2):
>   xen/arm: Rename init_secondary_pagetables() to prepare_secondary_mm()
>   xen/arm: mmu: move MMU specific P2M code to mmu/p2m.{c,h}
> 
> Wei Chen (2):
>   xen/arm64: head.S: Introduce enable_{boot,secondary}_cpu_mm()
>   xen/arm: Move MMU related definitions from config.h to mmu/layout.h
> 
>  xen/arch/arm/Kconfig|5 +-
>  xen/arch/arm/Makefile   |1 +
>  xen/arch/arm/arm32/Makefile |1 +
>  xen/arch/arm/arm32/head.S   |   22 +-
>  xen/arch/arm/arm32/mmu/Makefile |1 +
>  xen/arch/arm/arm32/mmu/mm.c |  301 
>  xen/arch/arm/arm64/Makefile |2 +-
>  xen/arch/arm/arm64/head.S   |  460 +-
>  xen/arch/arm/arm64/mmu/Makefile |2 +
>  xen/arch/arm/arm64/mmu/head.S   |  481 ++
>  xen/arch/arm/arm64/{ => mmu}/mm.c   |   84 ++
>  xen/arch/arm/include/asm/arm32/mm.h |1 +
>  xen/arch/arm/include/asm/arm64/macros.h |   36 +
>  xen/arch/arm/include/asm/config.h   |  132 +-
>  xen/arch/arm/include/asm/mm.h   |   28 +-
>  xen/arch/arm/include/asm/mmu/layout.h   |  146 ++
>  xen/arch/arm/include/asm/mmu/mm.h   |   41 +
>  xen/arch/arm/include/asm/mmu/p2m.h  |   18 +
>  xen/arch/arm/include/asm/p2m.h  |   26 +-
>  xen/arch/arm/include/asm/page.h |   15 -
>  xen/arch/arm/include/asm/setup.h|5 +
>  xen/arch/arm/kernel.c   |   28 -
>  xen/arch/arm/mm.c   | 1212 ---
>  xen/arch/arm/mmu/Makefile   |4 +
>  xen/arch/arm/mmu/p2m.c  | 1736 +
>  xen/arch/arm/mmu/pt.c   |  743 +
>  xen/arch/arm/mmu/setup.c|  372 +
>  xen/arch/arm/mmu/smpboot.c  |  121 ++
>  xen/arch/arm/p2m.c  | 1837 +--
>  xen/arch/arm/setup.c|  324 +---
>  xen/arch/arm/smpboot.c  |4 +-
>  xen/arch/arm/xen.lds.S  |1 +
>  32 files changed, 4222 insertions(+), 3968 deletions(-)
>  create mode 100644 xen/arch/arm/arm32/mmu/Makefile
>  create mode 100644 xen/arch/arm/arm32/mmu/mm.c
>  create mode 100644 xen/arch/arm/arm64/mmu/Makefile
>  create mode 100644 xen/arch/arm/arm64/mmu/head.S
>  rename xen/arch/arm/arm64/{ => mmu}/mm.c (60%)
>  create mode 100644 xen/arch/arm/include/asm/mmu/layout.h
>  create mode 100644 xen/arch/arm/include/asm/mmu/mm.h
>  create mode 100644 xen/arch/arm/include/asm/mmu/p2m.h
>  create mode 100644 xen/arch/arm/mmu/Makefile
>  create mode 100644 xen/arch/arm/mmu/p2m.c
>  create mode 100644 xen/arch/arm/mmu/pt.c
>  create mode 100644 xen/arch/arm/mmu/setup.c
>  create mode 100644 xen/arch/arm/mmu/smpboot.c
> 
> -- 
> 2.25.1
> 



[ovmf test] 182779: all pass - PUSHED

2023-09-08 Thread osstest service owner
flight 182779 ovmf real [real]
http://logs.test-lab.xenproject.org/osstest/logs/182779/

Perfect :-)
All tests in this flight passed as required
version targeted for testing:
 ovmf d4ae5df71190148c902942c3462245e97ed2fcc8
baseline version:
 ovmf 28a74d7ab22a33e3915eb747879d58797718f6f2

Last test of basis   182772  2023-09-08 18:19:00 Z0 days
Testing same since   182779  2023-09-08 20:44:14 Z0 days1 attempts


People who touched revisions under test:
  Avinash Bhargava 
  Michael D Kinney 
  Rebecca Cran 

jobs:
 build-amd64-xsm  pass
 build-i386-xsm   pass
 build-amd64  pass
 build-i386   pass
 build-amd64-libvirt  pass
 build-i386-libvirt   pass
 build-amd64-pvopspass
 build-i386-pvops pass
 test-amd64-amd64-xl-qemuu-ovmf-amd64 pass
 test-amd64-i386-xl-qemuu-ovmf-amd64  pass



sg-report-flight on osstest.test-lab.xenproject.org
logs: /home/logs/logs
images: /home/logs/images

Logs, config files, etc. are available at
http://logs.test-lab.xenproject.org/osstest/logs

Explanation of these reports, and of osstest in general, is at
http://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=README.email;hb=master
http://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=README;hb=master

Test harness code can be found at
http://xenbits.xen.org/gitweb?p=osstest.git;a=summary


Pushing revision :

To xenbits.xen.org:/home/xen/git/osstest/ovmf.git
   28a74d7ab2..d4ae5df711  d4ae5df71190148c902942c3462245e97ed2fcc8 -> 
xen-tested-master



[PATCH v4 5/5] xen/ppc: Enable full Xen build

2023-09-08 Thread Shawn Anastasio
Bring ppc's Makefile and arch.mk in line with arm and x86 to disable the
build overrides and enable the full Xen build.

Signed-off-by: Shawn Anastasio 
Reviewed-by: Jan Beulich 
---
 xen/arch/ppc/Makefile | 16 +++-
 xen/arch/ppc/arch.mk  |  3 ---
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/xen/arch/ppc/Makefile b/xen/arch/ppc/Makefile
index 6d5569ff64..71feb5e2c4 100644
--- a/xen/arch/ppc/Makefile
+++ b/xen/arch/ppc/Makefile
@@ -11,10 +11,24 @@ $(TARGET): $(TARGET)-syms
cp -f $< $@
 
 $(TARGET)-syms: $(objtree)/prelink.o $(obj)/xen.lds
-   $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) -o $@
+   $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< \
+   $(objtree)/common/symbols-dummy.o -o $(dot-target).0
+   $(NM) -pa --format=sysv $(dot-target).0 \
+   | $(objtree)/tools/symbols $(all_symbols) --sysv --sort \
+   > $(dot-target).0.S
+   $(MAKE) $(build)=$(@D) $(dot-target).0.o
+   $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< \
+   $(dot-target).0.o -o $(dot-target).1
+   $(NM) -pa --format=sysv $(dot-target).1 \
+   | $(objtree)/tools/symbols $(all_symbols) --sysv --sort \
+   > $(dot-target).1.S
+   $(MAKE) $(build)=$(@D) $(dot-target).1.o
+   $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) \
+   $(dot-target).1.o -o $@
$(NM) -pa --format=sysv $@ \
| $(objtree)/tools/symbols --all-symbols --xensyms --sysv 
--sort \
> $@.map
+   rm -f $(@D)/.$(@F).[0-9]*
 
 $(obj)/xen.lds: $(src)/xen.lds.S FORCE
$(call if_changed_dep,cpp_lds_S)
diff --git a/xen/arch/ppc/arch.mk b/xen/arch/ppc/arch.mk
index d05cbf1df5..917ad0e6a8 100644
--- a/xen/arch/ppc/arch.mk
+++ b/xen/arch/ppc/arch.mk
@@ -7,6 +7,3 @@ CFLAGS += -m64 -mlittle-endian -mcpu=$(ppc-march-y)
 CFLAGS += -mstrict-align -mcmodel=medium -mabi=elfv2 -fPIC -mno-altivec 
-mno-vsx -msoft-float
 
 LDFLAGS += -m elf64lppc
-
-# TODO: Drop override when more of the build is working
-override ALL_OBJS-y = arch/$(SRCARCH)/built_in.o common/libfdt/built_in.o 
lib/built_in.o
-- 
2.30.2




[PATCH v4 4/5] xen/ppc: Add stub function and symbol definitions

2023-09-08 Thread Shawn Anastasio
Add stub function and symbol definitions required by common code. If the
file that the definition is supposed to be located in doesn't already
exist yet, temporarily place its definition in the new stubs.c

Signed-off-by: Shawn Anastasio 
Acked-by: Jan Beulich 
---
v4: No changes.

v3:
  - (stubs.c) Drop ack_none hook definition

v2:
  - Use BUG_ON("unimplemented") instead of BUG() for unimplemented functions
to make searching easier.
  - (mm-radix.c) Drop total_pages definition
  - (mm-radix.c) Move __read_mostly from after variable name to before it in
declaration of `frametable_base_pdx`
  - (setup.c) Fix include order
  - (stubs.c) Drop stub .end hw_irq_controller hook

 xen/arch/ppc/Makefile   |   1 +
 xen/arch/ppc/mm-radix.c |  42 +
 xen/arch/ppc/setup.c|   8 +
 xen/arch/ppc/stubs.c| 339 
 4 files changed, 390 insertions(+)
 create mode 100644 xen/arch/ppc/stubs.c

diff --git a/xen/arch/ppc/Makefile b/xen/arch/ppc/Makefile
index b3205b8f7a..6d5569ff64 100644
--- a/xen/arch/ppc/Makefile
+++ b/xen/arch/ppc/Makefile
@@ -4,6 +4,7 @@ obj-$(CONFIG_EARLY_PRINTK) += early_printk.init.o
 obj-y += mm-radix.o
 obj-y += opal.o
 obj-y += setup.o
+obj-y += stubs.o
 obj-y += tlb-radix.o

 $(TARGET): $(TARGET)-syms
diff --git a/xen/arch/ppc/mm-radix.c b/xen/arch/ppc/mm-radix.c
index 06129cef9c..11d0f27b60 100644
--- a/xen/arch/ppc/mm-radix.c
+++ b/xen/arch/ppc/mm-radix.c
@@ -265,3 +265,45 @@ void __init setup_initial_pagetables(void)
 /* Turn on the MMU */
 enable_mmu();
 }
+
+/*
+ * TODO: Implement the functions below
+ */
+unsigned long __read_mostly frametable_base_pdx;
+
+void put_page(struct page_info *p)
+{
+BUG_ON("unimplemented");
+}
+
+void arch_dump_shared_mem_info(void)
+{
+BUG_ON("unimplemented");
+}
+
+int xenmem_add_to_physmap_one(struct domain *d,
+  unsigned int space,
+  union add_to_physmap_extra extra,
+  unsigned long idx,
+  gfn_t gfn)
+{
+BUG_ON("unimplemented");
+}
+
+int destroy_xen_mappings(unsigned long s, unsigned long e)
+{
+BUG_ON("unimplemented");
+}
+
+int map_pages_to_xen(unsigned long virt,
+ mfn_t mfn,
+ unsigned long nr_mfns,
+ unsigned int flags)
+{
+BUG_ON("unimplemented");
+}
+
+int __init populate_pt_range(unsigned long virt, unsigned long nr_mfns)
+{
+BUG_ON("unimplemented");
+}
diff --git a/xen/arch/ppc/setup.c b/xen/arch/ppc/setup.c
index 3fc7705d9b..959c1454a0 100644
--- a/xen/arch/ppc/setup.c
+++ b/xen/arch/ppc/setup.c
@@ -1,5 +1,8 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
 #include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -33,3 +36,8 @@ void __init noreturn start_xen(unsigned long r3, unsigned 
long r4,

 unreachable();
 }
+
+void arch_get_xen_caps(xen_capabilities_info_t *info)
+{
+BUG_ON("unimplemented");
+}
diff --git a/xen/arch/ppc/stubs.c b/xen/arch/ppc/stubs.c
new file mode 100644
index 00..4c276b0e39
--- /dev/null
+++ b/xen/arch/ppc/stubs.c
@@ -0,0 +1,339 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+/* smpboot.c */
+
+cpumask_t cpu_online_map;
+cpumask_t cpu_present_map;
+cpumask_t cpu_possible_map;
+
+/* ID of the PCPU we're running on */
+DEFINE_PER_CPU(unsigned int, cpu_id);
+/* XXX these seem awfully x86ish... */
+/* representing HT siblings of each logical CPU */
+DEFINE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_sibling_mask);
+/* representing HT and core siblings of each logical CPU */
+DEFINE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_core_mask);
+
+nodemask_t __read_mostly node_online_map = { { [0] = 1UL } };
+
+/* time.c */
+
+s_time_t get_s_time(void)
+{
+BUG_ON("unimplemented");
+}
+
+int reprogram_timer(s_time_t timeout)
+{
+BUG_ON("unimplemented");
+}
+
+void send_timer_event(struct vcpu *v)
+{
+BUG_ON("unimplemented");
+}
+
+/* traps.c */
+
+void show_execution_state(const struct cpu_user_regs *regs)
+{
+BUG_ON("unimplemented");
+}
+
+void arch_hypercall_tasklet_result(struct vcpu *v, long res)
+{
+BUG_ON("unimplemented");
+}
+
+void vcpu_show_execution_state(struct vcpu *v)
+{
+BUG_ON("unimplemented");
+}
+
+/* shutdown.c */
+
+void machine_restart(unsigned int delay_millisecs)
+{
+BUG_ON("unimplemented");
+}
+
+void machine_halt(void)
+{
+BUG_ON("unimplemented");
+}
+
+/* vm_event.c */
+
+void vm_event_fill_regs(vm_event_request_t *req)
+{
+BUG_ON("unimplemented");
+}
+
+void vm_event_set_registers(struct vcpu *v, vm_event_response_t *rsp)
+{
+BUG_ON("unimplemented");
+}
+
+void vm_event_monitor_next_interrupt(struct vcpu *v)
+{
+/* Not supported on PPC. */
+}
+
+/* domctl.c */
+void arch_get_domain_info(const struct domain *d,
+  struct xen_domctl_getdomaininfo *info)
+{
+BUG_O

[PATCH v4 0/5] ppc: Enable full Xen build

2023-09-08 Thread Shawn Anastasio
Hello all,

This patch series performs all of the additions necessary to drop the
build overrides for PPC and enable the full Xen build. Except in cases
where compatibile implementations already exist (e.g. atomic.h and
bitops.h), the newly added definitions are simple, unimplemented stubs
that just call BUG_ON("unimplemented").

Thanks,
Shawn

--
v4: Address review comments from v3. Add missing CCs.

v3: Address review comments from v2.

v2: Address review comments from v1. Some changes are still pending until
the following patches are merged:
  - [PATCH] mem-sharing: move (x86) / drop (Arm) arch_dump_shared_mem_info()
  https://lists.xen.org/archives/html/xen-devel/2023-08/msg00887.html

  - [PATCH] move max_page and total_pages to common code
  https://lists.xen.org/archives/html/xen-devel/2023-08/msg00874.html

Shawn Anastasio (5):
  xen/ppc: Implement atomic.h
  xen/ppc: Implement bitops.h
  xen/ppc: Define minimal stub headers required for full build
  xen/ppc: Add stub function and symbol definitions
  xen/ppc: Enable full Xen build

 xen/arch/ppc/Kconfig |   1 +
 xen/arch/ppc/Makefile|  17 +-
 xen/arch/ppc/arch.mk |   3 -
 xen/arch/ppc/include/asm/altp2m.h|  25 ++
 xen/arch/ppc/include/asm/atomic.h| 385 +++
 xen/arch/ppc/include/asm/bitops.h| 332 ++-
 xen/arch/ppc/include/asm/bug.h   |   9 +
 xen/arch/ppc/include/asm/cache.h |   2 +
 xen/arch/ppc/include/asm/config.h|  10 +
 xen/arch/ppc/include/asm/cpufeature.h|  10 +
 xen/arch/ppc/include/asm/current.h   |  43 +++
 xen/arch/ppc/include/asm/delay.h |  12 +
 xen/arch/ppc/include/asm/device.h|  53 
 xen/arch/ppc/include/asm/div64.h |  14 +
 xen/arch/ppc/include/asm/domain.h|  47 +++
 xen/arch/ppc/include/asm/event.h |  36 +++
 xen/arch/ppc/include/asm/flushtlb.h  |  24 ++
 xen/arch/ppc/include/asm/grant_table.h   |   5 +
 xen/arch/ppc/include/asm/guest_access.h  |  68 
 xen/arch/ppc/include/asm/guest_atomics.h |  23 ++
 xen/arch/ppc/include/asm/hardirq.h   |  19 ++
 xen/arch/ppc/include/asm/hypercall.h |   5 +
 xen/arch/ppc/include/asm/io.h|  16 +
 xen/arch/ppc/include/asm/iocap.h |   8 +
 xen/arch/ppc/include/asm/iommu.h |   8 +
 xen/arch/ppc/include/asm/irq.h   |  33 ++
 xen/arch/ppc/include/asm/mem_access.h|   5 +
 xen/arch/ppc/include/asm/memory.h|  14 +
 xen/arch/ppc/include/asm/mm.h| 243 +-
 xen/arch/ppc/include/asm/monitor.h   |  43 +++
 xen/arch/ppc/include/asm/nospec.h|  15 +
 xen/arch/ppc/include/asm/numa.h  |  26 ++
 xen/arch/ppc/include/asm/p2m.h   |  95 ++
 xen/arch/ppc/include/asm/page.h  |  18 ++
 xen/arch/ppc/include/asm/paging.h|   7 +
 xen/arch/ppc/include/asm/pci.h   |   7 +
 xen/arch/ppc/include/asm/percpu.h|  24 ++
 xen/arch/ppc/include/asm/processor.h |  10 +
 xen/arch/ppc/include/asm/random.h|   9 +
 xen/arch/ppc/include/asm/setup.h |   6 +
 xen/arch/ppc/include/asm/smp.h   |  18 ++
 xen/arch/ppc/include/asm/softirq.h   |   8 +
 xen/arch/ppc/include/asm/spinlock.h  |  15 +
 xen/arch/ppc/include/asm/system.h| 219 -
 xen/arch/ppc/include/asm/time.h  |  23 ++
 xen/arch/ppc/include/asm/vm_event.h  |  49 +++
 xen/arch/ppc/include/asm/xenoprof.h  |   0
 xen/arch/ppc/mm-radix.c  |  44 ++-
 xen/arch/ppc/setup.c |   8 +
 xen/arch/ppc/stubs.c | 339 
 xen/arch/ppc/tlb-radix.c |   2 +-
 xen/include/public/hvm/save.h|   2 +
 xen/include/public/pmu.h |   2 +
 xen/include/public/xen.h |   2 +
 54 files changed, 2450 insertions(+), 11 deletions(-)
 create mode 100644 xen/arch/ppc/include/asm/altp2m.h
 create mode 100644 xen/arch/ppc/include/asm/atomic.h
 create mode 100644 xen/arch/ppc/include/asm/cpufeature.h
 create mode 100644 xen/arch/ppc/include/asm/current.h
 create mode 100644 xen/arch/ppc/include/asm/delay.h
 create mode 100644 xen/arch/ppc/include/asm/device.h
 create mode 100644 xen/arch/ppc/include/asm/div64.h
 create mode 100644 xen/arch/ppc/include/asm/domain.h
 create mode 100644 xen/arch/ppc/include/asm/event.h
 create mode 100644 xen/arch/ppc/include/asm/flushtlb.h
 create mode 100644 xen/arch/ppc/include/asm/grant_table.h
 create mode 100644 xen/arch/ppc/include/asm/guest_access.h
 create mode 100644 xen/arch/ppc/include/asm/guest_atomics.h
 create mode 100644 xen/arch/ppc/include/asm/hardirq.h
 create mode 100644 xen/arch/ppc/include/asm/hypercall.h
 create mode 100644 xen/arch/ppc/include/asm/io.h
 create mode 100644 xen/arch/ppc/include/asm/iocap.h
 create mode 100644 xen/arch/ppc/include/asm/iommu.h
 create mode 100644 xen/arch/ppc/include/asm/irq.h
 create mode 100644 xen/arc

[PATCH v4 2/5] xen/ppc: Implement bitops.h

2023-09-08 Thread Shawn Anastasio
Implement bitops.h, based on Linux's implementation as of commit
5321d1b1afb9a17302c6cec79f0cbf823eb0d3fc. Though it is based off of
Linux's implementation, this code diverges significantly in a number of
ways:
  - Bitmap entries changed to 32-bit words to match X86 and Arm on Xen
  - PPC32-specific code paths dropped
  - Formatting completely re-done to more closely line up with Xen.
Including 4 space indentation.
  - Use GCC's __builtin_popcount* for hweight* implementation

Signed-off-by: Shawn Anastasio 
---
v4:
  - Mention __builtin_popcount impelmentation of hweight* in message
  - Change type of BITOP_MASK expression from unsigned long to unsigned
int
  - Fix remaining underscore-prefixed macro params/vars
  - Fix line wrapping in test_and_clear_bit{,s}
  - Change type of test_and_clear_bits' pointer parameter from void *
to unsigned int *. This was already done for other functions but
missed here.
  - De-macroize test_and_set_bits.
  - Fix formatting of ffs{,l} macro's unary operators
  - Drop extra blank in ffz() macro definition

v3:
  - Fix style of inline asm blocks.
  - Fix underscore-prefixed macro parameters/variables
  - Use __builtin_popcount for hweight* implementation
  - Update C functions to use proper Xen coding style

v2:
  - Clarify changes from Linux implementation in commit message
  - Use PPC_ATOMIC_{ENTRY,EXIT}_BARRIER macros from  instead
of hardcoded "sync" instructions in inline assembly blocks.
  - Fix macro line-continuing backslash spacing
  - Fix hard-tab usage in find_*_bit C functions.

 xen/arch/ppc/include/asm/bitops.h | 332 +-
 1 file changed, 329 insertions(+), 3 deletions(-)

diff --git a/xen/arch/ppc/include/asm/bitops.h 
b/xen/arch/ppc/include/asm/bitops.h
index 548e97b414..3e50778c4d 100644
--- a/xen/arch/ppc/include/asm/bitops.h
+++ b/xen/arch/ppc/include/asm/bitops.h
@@ -1,9 +1,335 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Adapted from Linux's arch/powerpc/include/asm/bitops.h.
+ *
+ * Merged version by David Gibson .
+ * Based on ppc64 versions by: Dave Engebretsen, Todd Inglett, Don
+ * Reed, Pat McCarthy, Peter Bergner, Anton Blanchard.  They
+ * originally took it from the ppc32 code.
+ */
 #ifndef _ASM_PPC_BITOPS_H
 #define _ASM_PPC_BITOPS_H

+#include 
+
+#define __set_bit(n, p) set_bit(n, p)
+#define __clear_bit(n, p)   clear_bit(n, p)
+
+#define BITOP_BITS_PER_WORD 32
+#define BITOP_MASK(nr)  (1U << ((nr) % BITOP_BITS_PER_WORD))
+#define BITOP_WORD(nr)  ((nr) / BITOP_BITS_PER_WORD)
+#define BITS_PER_BYTE   8
+
 /* PPC bit number conversion */
-#define PPC_BITLSHIFT(be)  (BITS_PER_LONG - 1 - (be))
-#define PPC_BIT(bit)   (1UL << PPC_BITLSHIFT(bit))
-#define PPC_BITMASK(bs, be)((PPC_BIT(bs) - PPC_BIT(be)) | PPC_BIT(bs))
+#define PPC_BITLSHIFT(be)(BITS_PER_LONG - 1 - (be))
+#define PPC_BIT(bit) (1UL << PPC_BITLSHIFT(bit))
+#define PPC_BITMASK(bs, be)  ((PPC_BIT(bs) - PPC_BIT(be)) | PPC_BIT(bs))
+
+/* Macro for generating the ***_bits() functions */
+#define DEFINE_BITOP(fn, op, prefix)   
\
+static inline void fn(unsigned long mask,  
\
+  volatile unsigned int *p_)   
\
+{  
\
+unsigned long old; 
\
+unsigned int *p = (unsigned int *)p_;  
\
+asm volatile ( prefix  
\
+   "1: lwarx %0,0,%3,0\n"  
\
+   #op "%I2 %0,%0,%2\n"
\
+   "stwcx. %0,0,%3\n"  
\
+   "bne- 1b\n" 
\
+   : "=&r" (old), "+m" (*p)
\
+   : "rK" (mask), "r" (p)  
\
+   : "cc", "memory" ); 
\
+}
+
+DEFINE_BITOP(set_bits, or, "")
+DEFINE_BITOP(change_bits, xor, "")
+
+#define DEFINE_CLROP(fn, prefix)   
\
+static inline void fn(unsigned long mask, volatile unsigned int *p_)   
\
+{  
\
+unsigned long old; 
\
+unsigned int *p = (unsigned int *)p_;  
\
+asm volatile ( prefix  
\
+   "1: lwarx %0,0,%3,0\n"  
\
+   "andc %0,%0,%2\n"   
\
+  

[PATCH v4 1/5] xen/ppc: Implement atomic.h

2023-09-08 Thread Shawn Anastasio
Implement atomic.h for PPC, based off of the original Xen 3.2
implementation. This implementation depends on some functions that are
not yet defined (notably __cmpxchg), so it can't yet be used.

Signed-off-by: Shawn Anastasio 
---
v4:
  - Clarify dependency on __cmpxchg which doesn't get implemented until
future patch
  - Drop !CONFIG_SMP case for PPC_ATOMIC_{ENTRY,EXIT}_BARRIER macro
definitions
  - Add missing newlines to inline asm instructions preceeding
PPC_ATOMIC_EXIT_BARRIER. This was only discovered by the change
to drop the !CONFIG_SMP definitions of those macros.
  - Fix line wrapping in atomic_compareandswap
  - Fix formatting of arch_cmpxchg macro

v3:
  - Drop full copyright text headers
  - Drop unnecessary spaces after casts
  - const-ize write_atomic_size
  - Don't use GNU 0-length array extension in read_atomic
  - Use "+m" asm constraint instead of separate "=m" and "m"
  - Fix line-continuing backslash formatting in arch_cmpxchg

v2:
  - Fix style of asm block constraints to include required spaces
  - Fix macro local variable naming (use trailing underscore instead of
leading)
  - Drop unnecessary parens in __atomic_add_unless

 xen/arch/ppc/include/asm/atomic.h | 385 ++
 xen/arch/ppc/include/asm/memory.h |  14 ++
 2 files changed, 399 insertions(+)
 create mode 100644 xen/arch/ppc/include/asm/atomic.h
 create mode 100644 xen/arch/ppc/include/asm/memory.h

diff --git a/xen/arch/ppc/include/asm/atomic.h 
b/xen/arch/ppc/include/asm/atomic.h
new file mode 100644
index 00..64168aa3f1
--- /dev/null
+++ b/xen/arch/ppc/include/asm/atomic.h
@@ -0,0 +1,385 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * PowerPC64 atomic operations
+ *
+ * Copyright (C) 2001 Paul Mackerras , IBM
+ * Copyright (C) 2001 Anton Blanchard , IBM
+ * Copyright Raptor Engineering LLC
+ */
+
+#ifndef _ASM_PPC64_ATOMIC_H_
+#define _ASM_PPC64_ATOMIC_H_
+
+#include 
+
+#include 
+
+static inline int atomic_read(const atomic_t *v)
+{
+return *(volatile int *)&v->counter;
+}
+
+static inline int _atomic_read(atomic_t v)
+{
+return v.counter;
+}
+
+static inline void atomic_set(atomic_t *v, int i)
+{
+v->counter = i;
+}
+
+static inline void _atomic_set(atomic_t *v, int i)
+{
+v->counter = i;
+}
+
+void __bad_atomic_read(const volatile void *p, void *res);
+void __bad_atomic_size(void);
+
+#define build_atomic_read(name, insn, type)
\
+static inline type name(const volatile type *addr) 
\
+{  
\
+type ret;  
\
+asm volatile ( insn "%U1%X1 %0,%1" : "=r" (ret) : "m<>" (*addr) ); 
\
+return ret;
\
+}
+
+#define build_atomic_write(name, insn, type)   
\
+static inline void name(volatile type *addr, type val) 
\
+{  
\
+asm volatile ( insn "%U0%X0 %1,%0" : "=m<>" (*addr) : "r" (val) ); 
\
+}
+
+#define build_add_sized(name, ldinsn, stinsn, type)
\
+static inline void name(volatile type *addr, type val) 
\
+{  
\
+type t;
\
+asm volatile ( "1: " ldinsn " %0,0,%3\n"   
\
+   "add%I2 %0,%0,%2\n" 
\
+   stinsn " %0,0,%3 \n"
\
+   "bne- 1b\n" 
\
+   : "=&r" (t), "+m" (*addr)   
\
+   : "r" (val), "r" (addr) 
\
+   : "cc" );   
\
+}
+
+build_atomic_read(read_u8_atomic, "lbz", uint8_t)
+build_atomic_read(read_u16_atomic, "lhz", uint16_t)
+build_atomic_read(read_u32_atomic, "lwz", uint32_t)
+build_atomic_read(read_u64_atomic, "ldz", uint64_t)
+
+build_atomic_write(write_u8_atomic, "stb", uint8_t)
+build_atomic_write(write_u16_atomic, "sth", uint16_t)
+build_atomic_write(write_u32_atomic, "stw", uint32_t)
+build_atomic_write(write_u64_atomic, "std", uint64_t)
+
+build_add_sized(add_u8_sized, "lbarx", "stbcx.",uint8_t)
+build_add_sized(add_u16_sized, "lharx", "sthcx.", uint16_t)
+build_add_sized(add_u32_sized, "lwarx", "stwcx.", uint32_t)
+
+#undef build_atomic_read
+#undef build_atomic_write
+#undef build_add_sized
+
+static always_inline void read_atomic_size(const volatile void *p, void *res,
+   unsigned int size)
+

[PATCH v4 3/5] xen/ppc: Define minimal stub headers required for full build

2023-09-08 Thread Shawn Anastasio
Additionally, change inclusion of asm/ headers to corresponding xen/ ones
throughout arch/ppc now that they work.

Signed-off-by: Shawn Anastasio 
---
v4:
  - (device.h) Fix underscore prefixes in DT_DEVICE_START macro
  - (mm.h) Fix padding blanks in newly added *_to_* macros
  - (mm.h) Drop inaccurate comment for virt_to_mfn/mfn_to_virt. The
implementation of these macros remains unchanged.
  - (mm.h) s/zero/NULL/g in comment of page_info::v::inuse::domain
  - (mm.h) Use uint_t instead of u types in struct page_info
  - (p2m.h) Drop ARM-specific p2m_type_t enumerations
  - (system.h) Fix hard tabs in xchg() macro
  - (system.h) Add missing '\n' in build_xchg inline assembly before
PPC_ATOMIC_EXIT_BARRIER.
  - (system.h) Fix formatting of switch statements.
  - (system.h) Fix formatting of cmpxchg() macro.
  - (system.h) Fix formatting of mb/rmb/wmb macros
  - (system.h) Drop dead !CONFIG_SMP definition of smp memory barriers
  - (system.h) Replace hand-coded asm memory barriers w/ barrier()
  - (time.h) Fix overly-long definition of force_update_vcpu_system_time

v3:
  - Drop procarea.h
  - Add SPDX headers to all headers touched or added by this patch
  - (altp2m.h) Use ASSERT_UNREACHABLE for function that is meant to
stay unimplemented
  - (current.h) Consistently use plain C types in struct cpu_info
  - (current.h) Fix formatting of inline asm in get_cpu_info()
  - (device.h) Drop unnecessary DEVICE_GIC enumeration inherited from
ARM
  - (div64.h) Drop underscore-prefixed macro variables, fix formatting
  - (domain.h) Drop unnecessary space after cast in guest_mode()
  - (guest_access.h) Clean up line wrapping of functions w/ many
parameters
  - (guest_atomics.h) Avoid overly-long stub macros
  - (grant_table.h) Add include guard + SPDX
  - (hypercall.h) Add include guard + SPDX
  - (mem_access.h) Add include guard + SPDX
  - (mm.h) BUG_ON("unimplemented") for mfn_to_gfn/set_gpfn_from_mfn
  - (mm.h) Define PDX_GROUP_SHIFT in terms of XEN_PT_SHIFT_LVL_3
  - (monitor.h) BUG_ON("unimplemented") for arch_monitor_get_capabilities
  - (system.h) Fix formatting of inline assembly + macros
  - (time.h) Fix too-deep indentation

v2:
  - Use BUG_ON("unimplemented") instead of BUG() for unimplemented functions
to make searching easier.
  - (altp2m.h) Drop Intel license in favor of an SPDX header
  - (altp2m.h) Drop  include in favor of  and
forward declarations of struct domain and struct vcpu.
  - (bug.h) Add TODO comments above BUG and BUG_FRAME implementations
  - (desc.h) Drop desc.h
  - (mm.h) Drop  include
  - (mm.h) Drop PGC_static definition
  - (mm.h) Drop max_page definition
  - (mm.h/mm-radix.c) Drop total_pages definition
  - (monitor.h) Drop  and  includes in favor
of just 
  - (page.h) Drop PAGE_ALIGN definition
  - (percpu.h) Drop  include
  - (procarea.h) Drop license text in favor of SPDX header
  - (procarea.h) Drop unnecessary forward declarations and 
include
  - (processor.h) Fix macro parameter naming (drop leading underscore)
  - (processor.h) Add explanation comment to cpu_relax()
  - (regs.h) Drop stray hunk adding  include
  - (system.h) Drop license text in favor of SPDX header
  - (system.h) Drop  include
  - (opal.c) Drop stray hunk changing opal.c includes

 xen/arch/ppc/Kconfig |   1 +
 xen/arch/ppc/include/asm/altp2m.h|  25 +++
 xen/arch/ppc/include/asm/bug.h   |   9 +
 xen/arch/ppc/include/asm/cache.h |   2 +
 xen/arch/ppc/include/asm/config.h|  10 +
 xen/arch/ppc/include/asm/cpufeature.h|  10 +
 xen/arch/ppc/include/asm/current.h   |  43 
 xen/arch/ppc/include/asm/delay.h |  12 ++
 xen/arch/ppc/include/asm/device.h|  53 +
 xen/arch/ppc/include/asm/div64.h |  14 ++
 xen/arch/ppc/include/asm/domain.h|  47 +
 xen/arch/ppc/include/asm/event.h |  36 
 xen/arch/ppc/include/asm/flushtlb.h  |  24 +++
 xen/arch/ppc/include/asm/grant_table.h   |   5 +
 xen/arch/ppc/include/asm/guest_access.h  |  68 +++
 xen/arch/ppc/include/asm/guest_atomics.h |  23 +++
 xen/arch/ppc/include/asm/hardirq.h   |  19 ++
 xen/arch/ppc/include/asm/hypercall.h |   5 +
 xen/arch/ppc/include/asm/io.h|  16 ++
 xen/arch/ppc/include/asm/iocap.h |   8 +
 xen/arch/ppc/include/asm/iommu.h |   8 +
 xen/arch/ppc/include/asm/irq.h   |  33 +++
 xen/arch/ppc/include/asm/mem_access.h|   5 +
 xen/arch/ppc/include/asm/mm.h| 243 ++-
 xen/arch/ppc/include/asm/monitor.h   |  43 
 xen/arch/ppc/include/asm/nospec.h|  15 ++
 xen/arch/ppc/include/asm/numa.h  |  26 +++
 xen/arch/ppc/include/asm/p2m.h   |  95 +
 xen/arch/ppc/include/asm/page.h  |  18 ++
 xen/arch/ppc/include/asm/paging.h|   7 +
 xen/arch/ppc/include/asm/pci.h   |   7 +
 xen/arch/ppc/include/asm/percpu.h|  24 +++
 xen/arch/ppc/include/asm/processor.h |  10 +
 x

[PATCH v3] docs/misra: add rule 2.1 exceptions

2023-09-08 Thread Stefano Stabellini
From: Stefano Stabellini 

During the discussions that led to the acceptance of Rule 2.1, we
decided on a few exceptions that were not properly recorded in
rules.rst. Add them now.

Signed-off-by: Stefano Stabellini 
Acked-by: Jan Beulich 
---
Nicola, does this work with ECLAIR?

I am referring to the locations of the SAF-2-safe tag on top of
call_psci_system_off, BUG, etc.

Changes in v3:
- added SAF-2-safe to safe.json
- added a few SAF-2-safe examples
---
 docs/misra/rules.rst| 13 -
 docs/misra/safe.json|  8 
 xen/arch/arm/psci.c |  1 +
 xen/arch/x86/shutdown.c |  1 +
 xen/include/xen/bug.h   |  2 ++
 5 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
index 34916e266a..82de4c645d 100644
--- a/docs/misra/rules.rst
+++ b/docs/misra/rules.rst
@@ -107,7 +107,18 @@ maintainers if you want to suggest a change.
* - `Rule 2.1 
`_
  - Required
  - A project shall not contain unreachable code
- -
+ - The following are allowed:
+ - Invariantly constant conditions, e.g. if(IS_ENABLED(CONFIG_HVM)) { 
S; }
+ - Switch with a controlling value statically determined not to
+   match one or more case statements
+ - Functions that are intended to be referenced only from
+   assembly code (e.g. 'do_trap_fiq')
+ - Deliberate unreachability caused by certain macros/functions,
+   e.g. BUG, assert_failed, panic, etc. See safe.json.
+ - asm-offsets.c, as they are not linked deliberately, because
+   they are used to generate definitions for asm modules
+ - Declarations without initializer are safe, as they are not
+   executed
 
* - `Rule 2.6 
`_
  - Advisory
diff --git a/docs/misra/safe.json b/docs/misra/safe.json
index 39c5c056c7..fc96a99fd5 100644
--- a/docs/misra/safe.json
+++ b/docs/misra/safe.json
@@ -20,6 +20,14 @@
 },
 {
 "id": "SAF-2-safe",
+"analyser": {
+"eclair": "MC3R1.R2.1"
+},
+"name": "Rule 2.1: deliberate unreachability",
+"text": "Macro or function designed to be unreachable."
+},
+{
+"id": "SAF-3-safe",
 "analyser": {},
 "name": "Sentinel",
 "text": "Next ID to be used"
diff --git a/xen/arch/arm/psci.c b/xen/arch/arm/psci.c
index 695d2fa1f1..2a8527cacc 100644
--- a/xen/arch/arm/psci.c
+++ b/xen/arch/arm/psci.c
@@ -59,6 +59,7 @@ void call_psci_cpu_off(void)
 }
 }
 
+/* SAF-2-safe */
 void call_psci_system_off(void)
 {
 if ( psci_ver > PSCI_VERSION(0, 1) )
diff --git a/xen/arch/x86/shutdown.c b/xen/arch/x86/shutdown.c
index 7619544d14..47e0f59024 100644
--- a/xen/arch/x86/shutdown.c
+++ b/xen/arch/x86/shutdown.c
@@ -118,6 +118,7 @@ static inline void kb_wait(void)
 break;
 }
 
+/* SAF-2-safe */
 static void noreturn cf_check __machine_halt(void *unused)
 {
 local_irq_disable();
diff --git a/xen/include/xen/bug.h b/xen/include/xen/bug.h
index e8a4eea71a..d47c54f034 100644
--- a/xen/include/xen/bug.h
+++ b/xen/include/xen/bug.h
@@ -117,6 +117,7 @@ struct bug_frame {
 #endif
 
 #ifndef BUG
+/* SAF-2-safe */
 #define BUG() do {  \
 BUG_FRAME(BUGFRAME_bug,  __LINE__, __FILE__, 0, NULL);  \
 unreachable();  \
@@ -124,6 +125,7 @@ struct bug_frame {
 #endif
 
 #ifndef assert_failed
+/* SAF-2-safe */
 #define assert_failed(msg) do { \
 BUG_FRAME(BUGFRAME_assert, __LINE__, __FILE__, 1, msg); \
 unreachable();  \
-- 
2.25.1




[qemu-mainline test] 182770: regressions - FAIL

2023-09-08 Thread osstest service owner
flight 182770 qemu-mainline real [real]
http://logs.test-lab.xenproject.org/osstest/logs/182770/

Regressions :-(

Tests which did not succeed and are blocking,
including tests which could not be run:
 build-arm64-xsm   6 xen-buildfail REGR. vs. 182707
 build-i3866 xen-buildfail REGR. vs. 182707
 build-arm64   6 xen-buildfail REGR. vs. 182707
 build-amd64-xsm   6 xen-buildfail REGR. vs. 182707
 build-amd64   6 xen-buildfail REGR. vs. 182707
 build-i386-xsm6 xen-buildfail REGR. vs. 182707
 build-armhf   6 xen-buildfail REGR. vs. 182707

Tests which did not succeed, but are not blocking:
 test-amd64-i386-xl-qemuu-debianhvm-amd64-shadow  1 build-check(1)  blocked n/a
 test-amd64-i386-xl-qemuu-debianhvm-i386-xsm  1 build-check(1)  blocked n/a
 test-amd64-i386-xl-qemuu-dmrestrict-amd64-dmrestrict 1 build-check(1) blocked 
n/a
 test-amd64-i386-xl-qemuu-ovmf-amd64  1 build-check(1)  blocked n/a
 test-amd64-i386-xl-qemuu-win7-amd64  1 build-check(1)  blocked n/a
 test-amd64-i386-xl-qemuu-ws16-amd64  1 build-check(1)  blocked n/a
 test-amd64-i386-xl-shadow 1 build-check(1)   blocked  n/a
 test-amd64-i386-xl-vhd1 build-check(1)   blocked  n/a
 test-amd64-i386-xl-xsm1 build-check(1)   blocked  n/a
 test-arm64-arm64-libvirt-raw  1 build-check(1)   blocked  n/a
 test-arm64-arm64-libvirt-xsm  1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl   1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl-credit1   1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl-credit2   1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl-thunderx  1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl-vhd   1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl-xsm   1 build-check(1)   blocked  n/a
 test-armhf-armhf-libvirt  1 build-check(1)   blocked  n/a
 test-armhf-armhf-libvirt-qcow2  1 build-check(1)   blocked  n/a
 test-armhf-armhf-libvirt-raw  1 build-check(1)   blocked  n/a
 test-armhf-armhf-xl   1 build-check(1)   blocked  n/a
 test-armhf-armhf-xl-arndale   1 build-check(1)   blocked  n/a
 test-armhf-armhf-xl-multivcpu  1 build-check(1)   blocked  n/a
 test-armhf-armhf-xl-rtds  1 build-check(1)   blocked  n/a
 test-armhf-armhf-xl-vhd   1 build-check(1)   blocked  n/a
 test-amd64-i386-qemuu-rhel6hvm-amd  1 build-check(1)   blocked n/a
 test-amd64-i386-pair  1 build-check(1)   blocked  n/a
 test-amd64-i386-libvirt-xsm   1 build-check(1)   blocked  n/a
 test-amd64-i386-libvirt-raw   1 build-check(1)   blocked  n/a
 test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm 1 build-check(1) blocked n/a
 test-amd64-i386-libvirt-pair  1 build-check(1)   blocked  n/a
 test-amd64-i386-libvirt   1 build-check(1)   blocked  n/a
 test-amd64-i386-freebsd10-i386  1 build-check(1)   blocked  n/a
 test-amd64-i386-freebsd10-amd64  1 build-check(1)   blocked  n/a
 test-amd64-coresched-i386-xl  1 build-check(1)   blocked  n/a
 test-amd64-coresched-amd64-xl  1 build-check(1)   blocked  n/a
 test-amd64-amd64-xl-xsm   1 build-check(1)   blocked  n/a
 build-amd64-libvirt   1 build-check(1)   blocked  n/a
 test-amd64-amd64-xl-shadow1 build-check(1)   blocked  n/a
 test-amd64-amd64-xl-rtds  1 build-check(1)   blocked  n/a
 build-arm64-libvirt   1 build-check(1)   blocked  n/a
 test-amd64-amd64-xl-qemuu-ws16-amd64  1 build-check(1) blocked n/a
 test-amd64-amd64-xl-qemuu-win7-amd64  1 build-check(1) blocked n/a
 test-amd64-amd64-xl-qemuu-ovmf-amd64  1 build-check(1) blocked n/a
 build-armhf-libvirt   1 build-check(1)   blocked  n/a
 test-amd64-amd64-xl-qemuu-dmrestrict-amd64-dmrestrict 1 build-check(1) blocked 
n/a
 build-i386-libvirt1 build-check(1)   blocked  n/a
 test-amd64-amd64-xl-qemuu-debianhvm-i386-xsm  1 build-check(1) blocked n/a
 test-amd64-amd64-dom0pvh-xl-amd  1 build-check(1)   blocked  n/a
 test-amd64-amd64-xl-qemuu-debianhvm-amd64-shadow  1 build-check(1) blocked n/a
 test-amd64-amd64-dom0pvh-xl-intel  1 build-check(1)   blocked  n/a
 test-amd64-amd64-xl-qemuu-debianhvm-amd64  1 build-check(1)blocked n/a
 test-amd64-amd64-libvirt  1 build-check(1)   blocked  n/a
 test-amd64-amd64-libvirt-pair  1 build-check(1)   blocked  n/a
 test-amd64-amd64-libvirt-qemuu-de

[xen-unstable test] 182735: tolerable FAIL - PUSHED

2023-09-08 Thread osstest service owner
flight 182735 xen-unstable real [real]
flight 182785 xen-unstable real-retest [real]
http://logs.test-lab.xenproject.org/osstest/logs/182735/
http://logs.test-lab.xenproject.org/osstest/logs/182785/

Failures :-/ but no regressions.

Tests which are failing intermittently (not blocking):
 test-amd64-i386-migrupgrade 10 xen-install/src_host fail pass in 182785-retest
 test-amd64-amd64-xl-qemut-debianhvm-i386-xsm 12 debian-hvm-install fail pass 
in 182785-retest
 test-amd64-amd64-xl-qemuu-win7-amd64 12 windows-install fail pass in 
182785-retest

Tests which did not succeed, but are not blocking:
 test-amd64-amd64-xl-qemuu-win7-amd64 19 guest-stop  fail in 182785 like 182717
 test-amd64-amd64-xl-qemut-win7-amd64 19 guest-stopfail like 182717
 test-amd64-i386-xl-qemuu-win7-amd64 19 guest-stop fail like 182717
 test-armhf-armhf-libvirt-qcow2 15 saverestore-support-check   fail like 182717
 test-armhf-armhf-libvirt-raw 15 saverestore-support-checkfail  like 182717
 test-amd64-amd64-xl-qemuu-ws16-amd64 19 guest-stopfail like 182717
 test-amd64-i386-xl-qemut-ws16-amd64 19 guest-stop fail like 182717
 test-amd64-i386-xl-qemut-win7-amd64 19 guest-stop fail like 182717
 test-armhf-armhf-libvirt 16 saverestore-support-checkfail  like 182717
 test-amd64-amd64-qemuu-nested-amd 20 debian-hvm-install/l1/l2 fail like 182717
 test-amd64-amd64-xl-qemut-ws16-amd64 19 guest-stopfail like 182717
 test-amd64-i386-xl-qemuu-ws16-amd64 19 guest-stop fail like 182717
 test-amd64-amd64-libvirt-xsm 15 migrate-support-checkfail   never pass
 test-amd64-amd64-libvirt 15 migrate-support-checkfail   never pass
 test-amd64-i386-xl-pvshim14 guest-start  fail   never pass
 test-amd64-i386-libvirt-xsm  15 migrate-support-checkfail   never pass
 test-amd64-i386-libvirt  15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-thunderx 15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-thunderx 16 saverestore-support-checkfail   never pass
 test-arm64-arm64-xl  15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl  16 saverestore-support-checkfail   never pass
 test-arm64-arm64-xl-xsm  15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-credit2  15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-xsm  16 saverestore-support-checkfail   never pass
 test-arm64-arm64-xl-credit2  16 saverestore-support-checkfail   never pass
 test-arm64-arm64-xl-credit1  15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-credit1  16 saverestore-support-checkfail   never pass
 test-arm64-arm64-libvirt-xsm 15 migrate-support-checkfail   never pass
 test-arm64-arm64-libvirt-xsm 16 saverestore-support-checkfail   never pass
 test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm 13 migrate-support-check 
fail never pass
 test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm 13 migrate-support-check 
fail never pass
 test-armhf-armhf-xl-arndale  15 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-arndale  16 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-multivcpu 15 migrate-support-checkfail  never pass
 test-armhf-armhf-xl-multivcpu 16 saverestore-support-checkfail  never pass
 test-armhf-armhf-xl  15 migrate-support-checkfail   never pass
 test-armhf-armhf-xl  16 saverestore-support-checkfail   never pass
 test-amd64-i386-libvirt-raw  14 migrate-support-checkfail   never pass
 test-arm64-arm64-libvirt-raw 14 migrate-support-checkfail   never pass
 test-arm64-arm64-libvirt-raw 15 saverestore-support-checkfail   never pass
 test-amd64-amd64-libvirt-vhd 14 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-vhd  14 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-vhd  15 saverestore-support-checkfail   never pass
 test-armhf-armhf-libvirt-qcow2 14 migrate-support-checkfail never pass
 test-armhf-armhf-libvirt-raw 14 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-vhd  14 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-vhd  15 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-rtds 15 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-rtds 16 saverestore-support-checkfail   never pass
 test-armhf-armhf-libvirt 15 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-credit2  15 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-credit2  16 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-credit1  15 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-credit1  16 saverestore-support-checkfail   never pass

version targeted for testing:
 xen   

[ovmf test] 182786: all pass - PUSHED

2023-09-08 Thread osstest service owner
flight 182786 ovmf real [real]
http://logs.test-lab.xenproject.org/osstest/logs/182786/

Perfect :-)
All tests in this flight passed as required
version targeted for testing:
 ovmf b240eab03530f063ef5438497d70a731b19a201e
baseline version:
 ovmf d4ae5df71190148c902942c3462245e97ed2fcc8

Last test of basis   182779  2023-09-08 20:44:14 Z0 days
Testing same since   182786  2023-09-08 22:40:42 Z0 days1 attempts


People who touched revisions under test:
  Andrei Otcheretianski 
  Michael D Kinney 

jobs:
 build-amd64-xsm  pass
 build-i386-xsm   pass
 build-amd64  pass
 build-i386   pass
 build-amd64-libvirt  pass
 build-i386-libvirt   pass
 build-amd64-pvopspass
 build-i386-pvops pass
 test-amd64-amd64-xl-qemuu-ovmf-amd64 pass
 test-amd64-i386-xl-qemuu-ovmf-amd64  pass



sg-report-flight on osstest.test-lab.xenproject.org
logs: /home/logs/logs
images: /home/logs/images

Logs, config files, etc. are available at
http://logs.test-lab.xenproject.org/osstest/logs

Explanation of these reports, and of osstest in general, is at
http://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=README.email;hb=master
http://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=README;hb=master

Test harness code can be found at
http://xenbits.xen.org/gitweb?p=osstest.git;a=summary


Pushing revision :

To xenbits.xen.org:/home/xen/git/osstest/ovmf.git
   d4ae5df711..b240eab035  b240eab03530f063ef5438497d70a731b19a201e -> 
xen-tested-master



[xen-unstable-smoke test] 182789: tolerable all pass - PUSHED

2023-09-08 Thread osstest service owner
flight 182789 xen-unstable-smoke real [real]
http://logs.test-lab.xenproject.org/osstest/logs/182789/

Failures :-/ but no regressions.

Tests which did not succeed, but are not blocking:
 test-amd64-amd64-libvirt 15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-xsm  15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-xsm  16 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl  15 migrate-support-checkfail   never pass
 test-armhf-armhf-xl  16 saverestore-support-checkfail   never pass

version targeted for testing:
 xen  49b2d6a529122f10e17a17f807d8d51154b5ba14
baseline version:
 xen  cba6d44a13d5e25334d164e27cb1b1d7674aa05e

Last test of basis   182726  2023-09-08 02:00:26 Z0 days
Testing same since   182789  2023-09-08 23:00:26 Z0 days1 attempts


People who touched revisions under test:
  Henry Wang 
  Julien Grall 
  Penny Zheng 
  Wei Chen 

jobs:
 build-arm64-xsm  pass
 build-amd64  pass
 build-armhf  pass
 build-amd64-libvirt  pass
 test-armhf-armhf-xl  pass
 test-arm64-arm64-xl-xsm  pass
 test-amd64-amd64-xl-qemuu-debianhvm-amd64pass
 test-amd64-amd64-libvirt pass



sg-report-flight on osstest.test-lab.xenproject.org
logs: /home/logs/logs
images: /home/logs/images

Logs, config files, etc. are available at
http://logs.test-lab.xenproject.org/osstest/logs

Explanation of these reports, and of osstest in general, is at
http://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=README.email;hb=master
http://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=README;hb=master

Test harness code can be found at
http://xenbits.xen.org/gitweb?p=osstest.git;a=summary


Pushing revision :

To xenbits.xen.org:/home/xen/git/xen.git
   cba6d44a13..49b2d6a529  49b2d6a529122f10e17a17f807d8d51154b5ba14 -> smoke



[PATCH v6 0/4] vPCI capabilities filtering

2023-09-08 Thread Stewart Hildebrand
This small series enables vPCI to filter which PCI capabilities we expose to a
domU. This series adds vPCI register handlers within
xen/drivers/vpci/header.c:init_bars(), along with some supporting functions.

Note there are minor rebase conflicts with the in-progress vPCI series [1].
These conflicts fall into the category of functions and code being added
adjacent to one another, so are easily resolved. I did not identify any
dependency on the vPCI locking work, and the two series deal with different
aspects of emulating the PCI header.

Future work may involve adding handlers for more registers in the vPCI header,
such as VID/DID, etc. Future work may also involve exposing additional
capabilities to the guest for broader device/driver support.

v5->v6:
* drop ("xen/pci: update PCI_STATUS_* constants") as it has been committed

v4->v5:
* drop ("x86/msi: remove some unused-but-set-variables") as it has been
  committed
* add ("xen/pci: update PCI_STATUS_* constants")
* squash ro_mask patch

v3->v4:
* drop "xen/pci: address a violation of MISRA C:2012 Rule 8.3" as it has been
  committed
* re-order status register handler and capabilities filtering patches
* split an unrelated change from ("xen/pci: convert pci_find_*cap* to 
pci_sbdf_t")
  into its own patch
* add new patch ("x86/msi: rearrange read_pci_mem_bar slightly") based on
  feedback
* add new RFC patch ("xen/vpci: support ro mask")

v2->v3:
* drop RFC "xen/vpci: header: avoid cast for value passed to vpci_read_val"
* minor misra C violation fixup in preparatory patch
* switch to pci_sbdf_t in preparatory patch
* introduce status handler

v1->v2:
* squash helper functions into the patch where they are used to avoid transient
  dead code situation
* add new RFC patch, possibly throwaway, to get an idea of what it would look
  like to get rid of the (void *)(uintptr_t) cast by introducing a new memory
  allocation

[1] https://lists.xenproject.org/archives/html/xen-devel/2023-08/msg02361.html

Stewart Hildebrand (4):
  xen/pci: convert pci_find_*cap* to pci_sbdf_t
  x86/msi: rearrange read_pci_mem_bar slightly
  xen/vpci: header: status register handler
  xen/vpci: header: filter PCI capabilities

 xen/arch/x86/msi.c | 62 ++-
 xen/drivers/char/ehci-dbgp.c   |  3 +-
 xen/drivers/passthrough/amd/iommu_detect.c |  2 +-
 xen/drivers/passthrough/ats.c  |  4 +-
 xen/drivers/passthrough/ats.h  |  6 +-
 xen/drivers/passthrough/msi.c  |  6 +-
 xen/drivers/passthrough/pci.c  | 21 ++---
 xen/drivers/passthrough/vtd/quirks.c   | 10 +--
 xen/drivers/passthrough/vtd/x86/ats.c  |  3 +-
 xen/drivers/pci/pci.c  | 52 -
 xen/drivers/vpci/header.c  | 89 ++
 xen/drivers/vpci/msi.c |  4 +-
 xen/drivers/vpci/msix.c|  4 +-
 xen/drivers/vpci/vpci.c| 67 +---
 xen/include/xen/pci.h  | 14 ++--
 xen/include/xen/pci_regs.h |  9 +++
 xen/include/xen/vpci.h | 13 
 17 files changed, 252 insertions(+), 117 deletions(-)


base-commit: 49b2d6a529122f10e17a17f807d8d51154b5ba14
-- 
2.42.0




[PATCH v6 1/4] xen/pci: convert pci_find_*cap* to pci_sbdf_t

2023-09-08 Thread Stewart Hildebrand
Convert pci_find_*cap* functions and call sites to pci_sbdf_t, and remove some
now unused local variables. Also change to more appropriate types on lines that
are already being modified as a result of the pci_sbdf_t conversion.

Signed-off-by: Stewart Hildebrand 
Reviewed-by: Jan Beulich 
---
I built with EXTRA_CFLAGS_XEN_CORE="-Wunused-but-set-variable" (and
unfortunately -Wno-error=unused-but-set-variable too) to identify locations of
unneeded local variables as a result of the change to pci_sbdf_t.

v5->v6:
* no change

v4->v5:
* add Jan's R-b

v3->v4:
* use more appropriate types on lines that are being modified anyway
* remove "no functional change" from commit description

v2->v3:
* new patch
---
 xen/arch/x86/msi.c | 40 ++
 xen/drivers/char/ehci-dbgp.c   |  3 +-
 xen/drivers/passthrough/amd/iommu_detect.c |  2 +-
 xen/drivers/passthrough/ats.c  |  4 +--
 xen/drivers/passthrough/ats.h  |  6 ++--
 xen/drivers/passthrough/msi.c  |  6 ++--
 xen/drivers/passthrough/pci.c  | 21 +---
 xen/drivers/passthrough/vtd/quirks.c   | 10 ++
 xen/drivers/passthrough/vtd/x86/ats.c  |  3 +-
 xen/drivers/pci/pci.c  | 32 +
 xen/drivers/vpci/msi.c |  4 +--
 xen/drivers/vpci/msix.c|  4 +--
 xen/include/xen/pci.h  | 11 +++---
 13 files changed, 58 insertions(+), 88 deletions(-)

diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c
index 41b82f3e87cb..8d4fd43b10a6 100644
--- a/xen/arch/x86/msi.c
+++ b/xen/arch/x86/msi.c
@@ -283,7 +283,7 @@ static void msi_set_enable(struct pci_dev *dev, int enable)
 u8 slot = PCI_SLOT(dev->devfn);
 u8 func = PCI_FUNC(dev->devfn);
 
-pos = pci_find_cap_offset(seg, bus, slot, func, PCI_CAP_ID_MSI);
+pos = pci_find_cap_offset(dev->sbdf, PCI_CAP_ID_MSI);
 if ( pos )
 __msi_set_enable(seg, bus, slot, func, pos, enable);
 }
@@ -291,12 +291,9 @@ static void msi_set_enable(struct pci_dev *dev, int enable)
 static void msix_set_enable(struct pci_dev *dev, int enable)
 {
 int pos;
-u16 control, seg = dev->seg;
-u8 bus = dev->bus;
-u8 slot = PCI_SLOT(dev->devfn);
-u8 func = PCI_FUNC(dev->devfn);
+uint16_t control;
 
-pos = pci_find_cap_offset(seg, bus, slot, func, PCI_CAP_ID_MSIX);
+pos = pci_find_cap_offset(dev->sbdf, PCI_CAP_ID_MSIX);
 if ( pos )
 {
 control = pci_conf_read16(dev->sbdf, msix_control_reg(pos));
@@ -603,13 +600,10 @@ static int msi_capability_init(struct pci_dev *dev,
 struct msi_desc *entry;
 int pos;
 unsigned int i, mpos;
-u16 control, seg = dev->seg;
-u8 bus = dev->bus;
-u8 slot = PCI_SLOT(dev->devfn);
-u8 func = PCI_FUNC(dev->devfn);
+uint16_t control;
 
 ASSERT(pcidevs_locked());
-pos = pci_find_cap_offset(seg, bus, slot, func, PCI_CAP_ID_MSI);
+pos = pci_find_cap_offset(dev->sbdf, PCI_CAP_ID_MSI);
 if ( !pos )
 return -ENODEV;
 control = pci_conf_read16(dev->sbdf, msi_control_reg(pos));
@@ -680,8 +674,8 @@ static u64 read_pci_mem_bar(u16 seg, u8 bus, u8 slot, u8 
func, u8 bir, int vf)
 {
 struct pci_dev *pdev = pci_get_pdev(NULL,
 PCI_SBDF(seg, bus, slot, func));
-unsigned int pos = pci_find_ext_capability(seg, bus,
-   PCI_DEVFN(slot, func),
+unsigned int pos = pci_find_ext_capability(PCI_SBDF(seg, bus, slot,
+func),
PCI_EXT_CAP_ID_SRIOV);
 uint16_t ctrl = pci_conf_read16(PCI_SBDF(seg, bus, slot, func),
 pos + PCI_SRIOV_CTRL);
@@ -772,8 +766,7 @@ static int msix_capability_init(struct pci_dev *dev,
 u8 slot = PCI_SLOT(dev->devfn);
 u8 func = PCI_FUNC(dev->devfn);
 bool maskall = msix->host_maskall, zap_on_error = false;
-unsigned int pos = pci_find_cap_offset(seg, bus, slot, func,
-   PCI_CAP_ID_MSIX);
+unsigned int pos = pci_find_cap_offset(dev->sbdf, PCI_CAP_ID_MSIX);
 
 if ( !pos )
 return -ENODEV;
@@ -1097,12 +1090,7 @@ static void _pci_cleanup_msix(struct arch_msix *msix)
 static void __pci_disable_msix(struct msi_desc *entry)
 {
 struct pci_dev *dev = entry->dev;
-u16 seg = dev->seg;
-u8 bus = dev->bus;
-u8 slot = PCI_SLOT(dev->devfn);
-u8 func = PCI_FUNC(dev->devfn);
-unsigned int pos = pci_find_cap_offset(seg, bus, slot, func,
-   PCI_CAP_ID_MSIX);
+unsigned int pos = pci_find_cap_offset(dev->sbdf, PCI_CAP_ID_MSIX);
 u16 control = pci_conf_read16(dev->sbdf,
   msix_control_reg(entry->msi_attrib.pos));
 bool maskall = dev->msix->host_maskall;
@@ -1206,8 +1194,7 @@ void p

[PATCH v6 2/4] x86/msi: rearrange read_pci_mem_bar slightly

2023-09-08 Thread Stewart Hildebrand
Use pdev->sbdf instead of the PCI_SBDF macro in calls to pci_* functions
where appropriate. Move NULL check earlier.

Suggested-by: Jan Beulich 
Signed-off-by: Stewart Hildebrand 
Reviewed-by: Jan Beulich 
---
v5->v6:
* no change

v4->v5:
* add Jan's R-b

v3->v4:
* new patch

Suggested-by tag added based on conversation at [1]

[1] https://lists.xenproject.org/archives/html/xen-devel/2023-08/msg01886.html
---
 xen/arch/x86/msi.c | 26 +-
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c
index 8d4fd43b10a6..a78367d7cf5d 100644
--- a/xen/arch/x86/msi.c
+++ b/xen/arch/x86/msi.c
@@ -674,19 +674,19 @@ static u64 read_pci_mem_bar(u16 seg, u8 bus, u8 slot, u8 
func, u8 bir, int vf)
 {
 struct pci_dev *pdev = pci_get_pdev(NULL,
 PCI_SBDF(seg, bus, slot, func));
-unsigned int pos = pci_find_ext_capability(PCI_SBDF(seg, bus, slot,
-func),
-   PCI_EXT_CAP_ID_SRIOV);
-uint16_t ctrl = pci_conf_read16(PCI_SBDF(seg, bus, slot, func),
-pos + PCI_SRIOV_CTRL);
-uint16_t num_vf = pci_conf_read16(PCI_SBDF(seg, bus, slot, func),
-  pos + PCI_SRIOV_NUM_VF);
-uint16_t offset = pci_conf_read16(PCI_SBDF(seg, bus, slot, func),
-  pos + PCI_SRIOV_VF_OFFSET);
-uint16_t stride = pci_conf_read16(PCI_SBDF(seg, bus, slot, func),
-  pos + PCI_SRIOV_VF_STRIDE);
-
-if ( !pdev || !pos ||
+unsigned int pos;
+uint16_t ctrl, num_vf, offset, stride;
+
+if ( !pdev )
+return 0;
+
+pos = pci_find_ext_capability(pdev->sbdf, PCI_EXT_CAP_ID_SRIOV);
+ctrl = pci_conf_read16(pdev->sbdf, pos + PCI_SRIOV_CTRL);
+num_vf = pci_conf_read16(pdev->sbdf, pos + PCI_SRIOV_NUM_VF);
+offset = pci_conf_read16(pdev->sbdf, pos + PCI_SRIOV_VF_OFFSET);
+stride = pci_conf_read16(pdev->sbdf, pos + PCI_SRIOV_VF_STRIDE);
+
+if ( !pos ||
  !(ctrl & PCI_SRIOV_CTRL_VFE) ||
  !(ctrl & PCI_SRIOV_CTRL_MSE) ||
  !num_vf || !offset || (num_vf > 1 && !stride) ||
-- 
2.42.0




[PATCH v6 3/4] xen/vpci: header: status register handler

2023-09-08 Thread Stewart Hildebrand
Introduce a handler for the PCI status register, with ability to mask the
capabilities bit. The status register contains RsvdZ bits, read-only bits, and
write-1-to-clear bits, so introduce bitmasks to handle these in vPCI. If a bit
in the bitmask is set, then the special meaning applies:

  rsvdz_mask: read as zero, guest write ignore (write zero to hardware)
  ro_mask: read normal, guest write ignore (preserve on write to hardware)
  rw1c_mask: read normal, write 1 to clear

The RsvdZ naming was borrowed from the PCI Express Base 4.0 specification.

Xen preserves the value of read-only bits on write to hardware, discarding the
guests write value.

The mask_cap_list flag will be set in a follow-on patch.

Signed-off-by: Stewart Hildebrand 
---
v5->v6:
* remove duplicate PCI_STATUS_CAP_LIST in constant definition
* style fixup in constant definitions
* s/res_mask/rsvdz_mask/
* combine a new masking operation into single line
* preserve r/o bits on write
* get rid of status_read. Instead, use rsvdz_mask for conditionally masking
  PCI_STATUS_CAP_LIST bit
* add comment about PCI_STATUS_CAP_LIST and rsvdp behavior
* add sanity checks in add_register
* move mask_cap_list from struct vpci_header to local variable

v4->v5:
* add support for res_mask
* add support for ro_mask (squash ro_mask patch)
* add constants for reserved, read-only, and rw1c masks

v3->v4:
* move mask_cap_list setting to the capabilities patch
* single pci_conf_read16 in status_read
* align mask_cap_list bitfield in struct vpci_header
* change to rw1c bit mask instead of treating whole register as rw1c
* drop subsystem prefix on renamed add_register function

v2->v3:
* new patch
---
 xen/drivers/vpci/header.c  | 13 +
 xen/drivers/vpci/vpci.c| 55 +-
 xen/include/xen/pci_regs.h |  9 +++
 xen/include/xen/vpci.h |  8 ++
 4 files changed, 73 insertions(+), 12 deletions(-)

diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c
index 767c1ba718d7..99dcf57678a8 100644
--- a/xen/drivers/vpci/header.c
+++ b/xen/drivers/vpci/header.c
@@ -521,6 +521,7 @@ static int cf_check init_bars(struct pci_dev *pdev)
 struct vpci_header *header = &pdev->vpci->header;
 struct vpci_bar *bars = header->bars;
 int rc;
+bool mask_cap_list = false;
 
 switch ( pci_conf_read8(pdev->sbdf, PCI_HEADER_TYPE) & 0x7f )
 {
@@ -544,6 +545,18 @@ static int cf_check init_bars(struct pci_dev *pdev)
 if ( rc )
 return rc;
 
+/*
+ * If mask_cap_list is true, PCI_STATUS_CAP_LIST will be set in both
+ * rsvdz_mask and ro_mask, and thus will effectively behave as rsvdp
+ * (reserved/RAZ and preserved on write).
+ */
+rc = vpci_add_register_mask(pdev->vpci, vpci_hw_read16, vpci_hw_write16,
+PCI_STATUS, 2, header, PCI_STATUS_RSVDZ_MASK |
+(mask_cap_list ? PCI_STATUS_CAP_LIST : 0),
+PCI_STATUS_RO_MASK, PCI_STATUS_RW1C_MASK);
+if ( rc )
+return rc;
+
 if ( pdev->ignore_bars )
 return 0;
 
diff --git a/xen/drivers/vpci/vpci.c b/xen/drivers/vpci/vpci.c
index 3bec9a4153da..586c6057365b 100644
--- a/xen/drivers/vpci/vpci.c
+++ b/xen/drivers/vpci/vpci.c
@@ -29,6 +29,9 @@ struct vpci_register {
 unsigned int offset;
 void *private;
 struct list_head node;
+uint32_t rsvdz_mask;
+uint32_t ro_mask;
+uint32_t rw1c_mask;
 };
 
 #ifdef __XEN__
@@ -145,9 +148,16 @@ uint32_t cf_check vpci_hw_read32(
 return pci_conf_read32(pdev->sbdf, reg);
 }
 
-int vpci_add_register(struct vpci *vpci, vpci_read_t *read_handler,
-  vpci_write_t *write_handler, unsigned int offset,
-  unsigned int size, void *data)
+void cf_check vpci_hw_write16(
+const struct pci_dev *pdev, unsigned int reg, uint32_t val, void *data)
+{
+pci_conf_write16(pdev->sbdf, reg, val);
+}
+
+static int add_register(struct vpci *vpci, vpci_read_t *read_handler,
+vpci_write_t *write_handler, unsigned int offset,
+unsigned int size, void *data, uint32_t rsvdz_mask,
+uint32_t ro_mask, uint32_t rw1c_mask)
 {
 struct list_head *prev;
 struct vpci_register *r;
@@ -155,7 +165,8 @@ int vpci_add_register(struct vpci *vpci, vpci_read_t 
*read_handler,
 /* Some sanity checks. */
 if ( (size != 1 && size != 2 && size != 4) ||
  offset >= PCI_CFG_SPACE_EXP_SIZE || (offset & (size - 1)) ||
- (!read_handler && !write_handler) )
+ (!read_handler && !write_handler) || (ro_mask & rw1c_mask) ||
+ (rsvdz_mask & rw1c_mask) )
 return -EINVAL;
 
 r = xmalloc(struct vpci_register);
@@ -167,6 +178,9 @@ int vpci_add_register(struct vpci *vpci, vpci_read_t 
*read_handler,
 r->size = size;
 r->offset = offset;
 r->private = data;
+r->rsvdz_mask = rsvdz_mask & (0xU >> (32 - 8 * size));
+r->ro_mas

[PATCH v6 4/4] xen/vpci: header: filter PCI capabilities

2023-09-08 Thread Stewart Hildebrand
Currently, Xen vPCI only supports virtualizing the MSI and MSI-X capabilities.
Hide all other PCI capabilities (including extended capabilities) from domUs for
now, even though there may be certain devices/drivers that depend on being able
to discover certain capabilities.

We parse the physical PCI capabilities linked list and add vPCI register
handlers for the next elements, inserting our own next value, thus presenting a
modified linked list to the domU.

Introduce helper functions vpci_hw_read8 and vpci_read_val. The vpci_read_val
helper function returns a fixed value, which may be used for RAZ registers, or
registers whose value doesn't change.

Introduce pci_find_next_cap_ttl() helper while adapting the logic from
pci_find_next_cap() to suit our needs, and implement the existing
pci_find_next_cap() in terms of the new helper.

Signed-off-by: Stewart Hildebrand 
Reviewed-by: Jan Beulich 
---
v5->v6:
* add register handlers before status register handler in init_bars()
* s/header->mask_cap_list/mask_cap_list/

v4->v5:
* use more appropriate types, continued
* get rid of unnecessary hook function
* add Jan's R-b

v3->v4:
* move mask_cap_list setting to this patch
* leave pci_find_next_cap signature alone
* use more appropriate types

v2->v3:
* get rid of > 0 in loop condition
* implement pci_find_next_cap in terms of new pci_find_next_cap_ttl function so
  that hypothetical future callers wouldn't be required to pass &ttl.
* change NULL to (void *)0 for RAZ value passed to vpci_read_val
* change type of ttl to unsigned int
* remember to mask off the low 2 bits of next in the initial loop iteration
* change return type of pci_find_next_cap and pci_find_next_cap_ttl
* avoid wrapping the PCI_STATUS_CAP_LIST condition by using ! instead of == 0

v1->v2:
* change type of ttl to int
* use switch statement instead of if/else
* adapt existing pci_find_next_cap helper instead of rolling our own
* pass ttl as in/out
* "pass through" the lower 2 bits of the next pointer
* squash helper functions into this patch to avoid transient dead code situation
* extended capabilities RAZ/WI
---
 xen/drivers/pci/pci.c | 26 +-
 xen/drivers/vpci/header.c | 76 +++
 xen/drivers/vpci/vpci.c   | 12 +++
 xen/include/xen/pci.h |  3 ++
 xen/include/xen/vpci.h|  5 +++
 5 files changed, 113 insertions(+), 9 deletions(-)

diff --git a/xen/drivers/pci/pci.c b/xen/drivers/pci/pci.c
index 3569ccb24e9e..8799d60c2156 100644
--- a/xen/drivers/pci/pci.c
+++ b/xen/drivers/pci/pci.c
@@ -39,31 +39,39 @@ unsigned int pci_find_cap_offset(pci_sbdf_t sbdf, unsigned 
int cap)
 return 0;
 }
 
-unsigned int pci_find_next_cap(pci_sbdf_t sbdf, unsigned int pos,
-   unsigned int cap)
+unsigned int pci_find_next_cap_ttl(pci_sbdf_t sbdf, unsigned int pos,
+   bool (*is_match)(unsigned int),
+   unsigned int cap, unsigned int *ttl)
 {
-u8 id;
-int ttl = 48;
+unsigned int id;
 
-while ( ttl-- )
+while ( (*ttl)-- )
 {
 pos = pci_conf_read8(sbdf, pos);
 if ( pos < 0x40 )
 break;
 
-pos &= ~3;
-id = pci_conf_read8(sbdf, pos + PCI_CAP_LIST_ID);
+id = pci_conf_read8(sbdf, (pos & ~3) + PCI_CAP_LIST_ID);
 
 if ( id == 0xff )
 break;
-if ( id == cap )
+if ( (is_match && is_match(id)) || (!is_match && id == cap) )
 return pos;
 
-pos += PCI_CAP_LIST_NEXT;
+pos = (pos & ~3) + PCI_CAP_LIST_NEXT;
 }
+
 return 0;
 }
 
+unsigned int pci_find_next_cap(pci_sbdf_t sbdf, unsigned int pos,
+   unsigned int cap)
+{
+unsigned int ttl = 48;
+
+return pci_find_next_cap_ttl(sbdf, pos, NULL, cap, &ttl) & ~3;
+}
+
 /**
  * pci_find_ext_capability - Find an extended capability
  * @sbdf: PCI device to query
diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c
index 99dcf57678a8..118dd5d4535d 100644
--- a/xen/drivers/vpci/header.c
+++ b/xen/drivers/vpci/header.c
@@ -513,6 +513,18 @@ static void cf_check rom_write(
 rom->addr = val & PCI_ROM_ADDRESS_MASK;
 }
 
+static bool cf_check vpci_cap_supported(unsigned int id)
+{
+switch ( id )
+{
+case PCI_CAP_ID_MSI:
+case PCI_CAP_ID_MSIX:
+return true;
+default:
+return false;
+}
+}
+
 static int cf_check init_bars(struct pci_dev *pdev)
 {
 uint16_t cmd;
@@ -545,6 +557,70 @@ static int cf_check init_bars(struct pci_dev *pdev)
 if ( rc )
 return rc;
 
+if ( !is_hardware_domain(pdev->domain) )
+{
+if ( !(pci_conf_read16(pdev->sbdf, PCI_STATUS) & PCI_STATUS_CAP_LIST) )
+{
+/* RAZ/WI */
+rc = vpci_add_register(pdev->vpci, vpci_read_val, NULL,
+   PCI_CAPABILITY_LIST, 1, (void *)0);
+if ( rc )
+return rc;
+}
+else
+

[qemu-mainline test] 182796: regressions - FAIL

2023-09-08 Thread osstest service owner
flight 182796 qemu-mainline real [real]
http://logs.test-lab.xenproject.org/osstest/logs/182796/

Regressions :-(

Tests which did not succeed and are blocking,
including tests which could not be run:
 build-arm64-xsm   6 xen-buildfail REGR. vs. 182707
 build-i3866 xen-buildfail REGR. vs. 182707
 build-arm64   6 xen-buildfail REGR. vs. 182707
 build-amd64-xsm   6 xen-buildfail REGR. vs. 182707
 build-amd64   6 xen-buildfail REGR. vs. 182707
 build-i386-xsm6 xen-buildfail REGR. vs. 182707
 build-armhf   6 xen-buildfail REGR. vs. 182707

Tests which did not succeed, but are not blocking:
 test-amd64-i386-xl-qemuu-debianhvm-amd64-shadow  1 build-check(1)  blocked n/a
 test-amd64-i386-xl-qemuu-debianhvm-i386-xsm  1 build-check(1)  blocked n/a
 test-amd64-i386-xl-qemuu-dmrestrict-amd64-dmrestrict 1 build-check(1) blocked 
n/a
 test-amd64-i386-xl-qemuu-ovmf-amd64  1 build-check(1)  blocked n/a
 test-amd64-i386-xl-qemuu-win7-amd64  1 build-check(1)  blocked n/a
 test-amd64-i386-xl-qemuu-ws16-amd64  1 build-check(1)  blocked n/a
 test-amd64-i386-xl-shadow 1 build-check(1)   blocked  n/a
 test-amd64-i386-xl-vhd1 build-check(1)   blocked  n/a
 test-amd64-i386-xl-xsm1 build-check(1)   blocked  n/a
 test-arm64-arm64-libvirt-raw  1 build-check(1)   blocked  n/a
 test-arm64-arm64-libvirt-xsm  1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl   1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl-credit1   1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl-credit2   1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl-thunderx  1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl-vhd   1 build-check(1)   blocked  n/a
 test-arm64-arm64-xl-xsm   1 build-check(1)   blocked  n/a
 test-armhf-armhf-libvirt  1 build-check(1)   blocked  n/a
 test-armhf-armhf-libvirt-qcow2  1 build-check(1)   blocked  n/a
 test-armhf-armhf-libvirt-raw  1 build-check(1)   blocked  n/a
 test-armhf-armhf-xl   1 build-check(1)   blocked  n/a
 test-armhf-armhf-xl-arndale   1 build-check(1)   blocked  n/a
 test-armhf-armhf-xl-multivcpu  1 build-check(1)   blocked  n/a
 test-armhf-armhf-xl-rtds  1 build-check(1)   blocked  n/a
 test-armhf-armhf-xl-vhd   1 build-check(1)   blocked  n/a
 test-amd64-i386-qemuu-rhel6hvm-amd  1 build-check(1)   blocked n/a
 test-amd64-i386-pair  1 build-check(1)   blocked  n/a
 test-amd64-i386-libvirt-xsm   1 build-check(1)   blocked  n/a
 test-amd64-i386-libvirt-raw   1 build-check(1)   blocked  n/a
 test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm 1 build-check(1) blocked n/a
 test-amd64-i386-libvirt-pair  1 build-check(1)   blocked  n/a
 test-amd64-i386-libvirt   1 build-check(1)   blocked  n/a
 test-amd64-i386-freebsd10-i386  1 build-check(1)   blocked  n/a
 test-amd64-i386-freebsd10-amd64  1 build-check(1)   blocked  n/a
 test-amd64-coresched-i386-xl  1 build-check(1)   blocked  n/a
 test-amd64-coresched-amd64-xl  1 build-check(1)   blocked  n/a
 test-amd64-amd64-xl-xsm   1 build-check(1)   blocked  n/a
 build-amd64-libvirt   1 build-check(1)   blocked  n/a
 test-amd64-amd64-xl-shadow1 build-check(1)   blocked  n/a
 test-amd64-amd64-xl-rtds  1 build-check(1)   blocked  n/a
 build-arm64-libvirt   1 build-check(1)   blocked  n/a
 test-amd64-amd64-xl-qemuu-ws16-amd64  1 build-check(1) blocked n/a
 test-amd64-amd64-xl-qemuu-win7-amd64  1 build-check(1) blocked n/a
 test-amd64-amd64-xl-qemuu-ovmf-amd64  1 build-check(1) blocked n/a
 build-armhf-libvirt   1 build-check(1)   blocked  n/a
 test-amd64-amd64-xl-qemuu-dmrestrict-amd64-dmrestrict 1 build-check(1) blocked 
n/a
 build-i386-libvirt1 build-check(1)   blocked  n/a
 test-amd64-amd64-xl-qemuu-debianhvm-i386-xsm  1 build-check(1) blocked n/a
 test-amd64-amd64-dom0pvh-xl-amd  1 build-check(1)   blocked  n/a
 test-amd64-amd64-xl-qemuu-debianhvm-amd64-shadow  1 build-check(1) blocked n/a
 test-amd64-amd64-dom0pvh-xl-intel  1 build-check(1)   blocked  n/a
 test-amd64-amd64-xl-qemuu-debianhvm-amd64  1 build-check(1)blocked n/a
 test-amd64-amd64-libvirt  1 build-check(1)   blocked  n/a
 test-amd64-amd64-libvirt-pair  1 build-check(1)   blocked  n/a
 test-amd64-amd64-libvirt-qemuu-de

[qemu-mainline bisection] complete build-arm64-xsm

2023-09-08 Thread osstest service owner
branch xen-unstable
xenbranch xen-unstable
job build-arm64-xsm
testid xen-build

Tree: ovmf git://xenbits.xen.org/osstest/ovmf.git
Tree: qemuu https://gitlab.com/qemu-project/qemu.git
Tree: seabios git://xenbits.xen.org/osstest/seabios.git
Tree: xen git://xenbits.xen.org/xen.git

*** Found and reproduced problem changeset ***

  Bug is in tree:  qemuu https://gitlab.com/qemu-project/qemu.git
  Bug introduced:  ca056f4499c259c0de68ed7cefad7ee7b62bfa43
  Bug not present: a5e9fbf1dfd5b3f901f987755c89f1dc636c3747
  Last fail repro: http://logs.test-lab.xenproject.org/osstest/logs/182800/


  commit ca056f4499c259c0de68ed7cefad7ee7b62bfa43
  Author: Paolo Bonzini 
  Date:   Wed May 3 12:48:02 2023 +0200
  
  Python: Drop support for Python 3.7
  
  Debian 10 is not anymore a supported distro, since Debian 12 was
  released on June 10, 2023.  Our supported build platforms as of today
  all support at least 3.8 (and all of them except for Ubuntu 20.04
  support 3.9):
  
  openSUSE Leap 15.5: 3.6.15 (3.11.2)
  CentOS Stream 8:3.6.8  (3.8.13, 3.9.16, 3.11.4)
  CentOS Stream 9:3.9.17 (3.11.4)
  Fedora 37:  3.11.4
  Fedora 38:  3.11.4
  Debian 11:  3.9.2
  Debian 12:  3.11.2
  Alpine 3.14, 3.15:  3.9.16
  Alpine 3.16, 3.17:  3.10.10
  Ubuntu 20.04 LTS:   3.8.10
  Ubuntu 22.04 LTS:   3.10.12
  NetBSD 9.3: 3.9.13*
  FreeBSD 12.4:   3.9.16
  FreeBSD 13.1:   3.9.18
  OpenBSD 7.2:3.9.17
  
  Note: NetBSD does not appear to have a default meta-package, but offers
  several options, the lowest of which is 3.7.15. However, "python39"
  appears to be a pre-requisite to one of the other packages we request
  in tests/vm/netbsd.
  
  Since it is safe under our supported platform policy, bump our
  minimum supported version of Python to 3.8.  The two most interesting
  features to have by default include:
  
  - the importlib.metadata module, whose lack is responsible for over 100
lines of code in mkvenv.py
  
  - improvements to asyncio, for example asyncio.CancelledError
inherits from BaseException rather than Exception
  
  In addition, code can now use the assignment operator ':='
  
  Because mypy now learns about importlib.metadata, a small change to
  mkvenv.py is needed to pass type checking.
  
  Signed-off-by: Paolo Bonzini 


For bisection revision-tuple graph see:
   
http://logs.test-lab.xenproject.org/osstest/results/bisect/qemu-mainline/build-arm64-xsm.xen-build.html
Revision IDs in each graph node refer, respectively, to the Trees above.


Running cs-bisection-step 
--graph-out=/home/logs/results/bisect/qemu-mainline/build-arm64-xsm.xen-build 
--summary-out=tmp/182800.bisection-summary --basis-template=182707 
--blessings=real,real-bisect,real-retry qemu-mainline build-arm64-xsm xen-build
Searching for failure / basis pass:
 182796 fail [host=rochester0] / 182707 [host=rochester1] 182638 
[host=rochester1] 182606 [host=rochester1] 182588 ok.
Failure / basis pass flights: 182796 / 182588
Tree: ovmf git://xenbits.xen.org/osstest/ovmf.git
Tree: qemuu https://gitlab.com/qemu-project/qemu.git
Tree: seabios git://xenbits.xen.org/osstest/seabios.git
Tree: xen git://xenbits.xen.org/xen.git
Latest d4ae5df71190148c902942c3462245e97ed2fcc8 
c5ea91da443b458352c1b629b490ee6631775cb4 
7a4003be25eae462f3c3d8aad96b57e34dc0c2b8 
b2dd946ece74e2b6e0601f28caef72f4f9950102
Basis pass beafabdae49c873adecdb7511dbebe9d4ff5c8f0 
17780edd81d27fcfdb7a802efc870a99788bd2fc 
7a4003be25eae462f3c3d8aad96b57e34dc0c2b8 
e5522c71beaa83f2f5d2118724ace9f90c22e583
Generating revisions with ./adhoc-revtuple-generator  
git://xenbits.xen.org/osstest/ovmf.git#beafabdae49c873adecdb7511dbebe9d4ff5c8f0-d4ae5df71190148c902942c3462245e97ed2fcc8
 
https://gitlab.com/qemu-project/qemu.git#17780edd81d27fcfdb7a802efc870a99788bd2fc-c5ea91da443b458352c1b629b490ee6631775cb4
 
git://xenbits.xen.org/osstest/seabios.git#7a4003be25eae462f3c3d8aad96b57e34dc0c2b8-7a4003be25eae462f3c3d8aad96b57e34dc0c2b8
 git://xenbits.xen.org/xen.git#e5522c71beaa83f2f5d2118724ace9f90c22e583-b2dd946\
 ece74e2b6e0601f28caef72f4f9950102
Loaded 20167 nodes in revision graph
Searching for test results:
 182588 pass beafabdae49c873adecdb7511dbebe9d4ff5c8f0 
17780edd81d27fcfdb7a802efc870a99788bd2fc 
7a4003be25eae462f3c3d8aad96b57e34dc0c2b8 
e5522c71beaa83f2f5d2118724ace9f90c22e583
 182606 [host=rochester1]
 182638 [host=rochester1]
 182707 [host=rochester1]
 182723 fail irrelevant
 182731 pass beafabdae49c873adecdb7511dbebe9d4ff5c8f0 
17780edd81d27fcfdb7a802efc870a99788bd2fc 
7a4003be25eae462f3c3d8aad96b57e34dc0c2b8 
e5522c71beaa83f2f5d2118724ace9f90c22e583
 182733 fail irrelevant
 182730 fail 634192665ea22eb610ad54f10bad8143ef77076d 
03a3a62fbd0aa5227e978eef3c67d3978aec9e5f 
7a4003be25eae462f3c3d8aad96b57e34dc0

[linux-linus test] 182763: regressions - FAIL

2023-09-08 Thread osstest service owner
flight 182763 linux-linus real [real]
http://logs.test-lab.xenproject.org/osstest/logs/182763/

Regressions :-(

Tests which did not succeed and are blocking,
including tests which could not be run:
 test-amd64-amd64-libvirt-raw  8 xen-boot fail REGR. vs. 182531
 test-amd64-amd64-xl-xsm   8 xen-boot fail REGR. vs. 182531
 test-amd64-amd64-xl-vhd   8 xen-boot fail REGR. vs. 182531
 test-amd64-amd64-xl-pvshim8 xen-boot fail REGR. vs. 182531
 test-amd64-amd64-freebsd12-amd64  8 xen-boot fail REGR. vs. 182531
 test-amd64-amd64-xl-pvhv2-intel  8 xen-boot  fail REGR. vs. 182531
 test-amd64-amd64-xl-qemuu-ws16-amd64  8 xen-boot fail REGR. vs. 182531
 test-amd64-amd64-xl-credit1   8 xen-boot fail REGR. vs. 182531
 test-amd64-amd64-libvirt-xsm  8 xen-boot fail REGR. vs. 182531
 test-amd64-amd64-xl-shadow8 xen-boot fail REGR. vs. 182531
 test-amd64-amd64-xl-qemut-win7-amd64  8 xen-boot fail REGR. vs. 182531
 test-amd64-amd64-xl-qemuu-win7-amd64  8 xen-boot fail REGR. vs. 182531
 test-amd64-amd64-dom0pvh-xl-amd 14 guest-start   fail REGR. vs. 182531
 test-amd64-amd64-xl-qemut-debianhvm-i386-xsm  8 xen-boot fail REGR. vs. 182531
 test-amd64-amd64-xl-qemuu-dmrestrict-amd64-dmrestrict 8 xen-boot fail REGR. 
vs. 182531
 test-amd64-amd64-xl-qemuu-debianhvm-amd64  8 xen-bootfail REGR. vs. 182531
 test-amd64-amd64-xl-multivcpu  8 xen-bootfail REGR. vs. 182531
 test-amd64-amd64-libvirt-qcow2  8 xen-boot   fail REGR. vs. 182531
 test-amd64-amd64-pair12 xen-boot/src_hostfail REGR. vs. 182531
 test-amd64-amd64-pair13 xen-boot/dst_hostfail REGR. vs. 182531
 test-amd64-amd64-qemuu-nested-intel  8 xen-boot  fail REGR. vs. 182531
 test-amd64-amd64-libvirt-pair 12 xen-boot/src_host   fail REGR. vs. 182531
 test-amd64-amd64-libvirt-pair 13 xen-boot/dst_host   fail REGR. vs. 182531
 test-amd64-amd64-examine-uefi  8 reboot  fail REGR. vs. 182531
 test-amd64-amd64-xl-qemut-ws16-amd64  8 xen-boot fail REGR. vs. 182531
 test-amd64-amd64-qemuu-nested-amd  8 xen-bootfail REGR. vs. 182531
 test-amd64-amd64-xl-pvhv2-amd  8 xen-bootfail REGR. vs. 182531
 test-amd64-amd64-xl-qemuu-ovmf-amd64  8 xen-boot fail REGR. vs. 182531
 test-amd64-amd64-xl-qemut-debianhvm-amd64  8 xen-bootfail REGR. vs. 182531
 test-amd64-amd64-dom0pvh-xl-intel 14 guest-start fail REGR. vs. 182531
 test-amd64-amd64-xl   8 xen-boot fail REGR. vs. 182531
 test-amd64-amd64-libvirt  8 xen-boot fail REGR. vs. 182531
 test-amd64-amd64-freebsd11-amd64  8 xen-boot fail REGR. vs. 182531
 test-amd64-amd64-pygrub   8 xen-boot fail REGR. vs. 182531
 test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm 8 xen-boot fail REGR. vs. 
182531
 test-amd64-amd64-xl-qemut-stubdom-debianhvm-amd64-xsm 8 xen-boot fail REGR. 
vs. 182531
 test-amd64-amd64-xl-credit2   8 xen-boot fail REGR. vs. 182531
 test-amd64-amd64-examine-bios  8 reboot  fail REGR. vs. 182531
 test-amd64-coresched-amd64-xl  8 xen-bootfail REGR. vs. 182531
 test-amd64-amd64-xl-qemuu-debianhvm-i386-xsm  8 xen-boot fail REGR. vs. 182531
 test-amd64-amd64-examine  8 reboot   fail REGR. vs. 182531
 test-amd64-amd64-xl-qemuu-debianhvm-amd64-shadow 8 xen-boot fail REGR. vs. 
182531

Tests which are failing intermittently (not blocking):
 test-armhf-armhf-libvirt-qcow2 10 host-ping-check-xen  fail pass in 182729

Regressions which are regarded as allowable (not blocking):
 test-amd64-amd64-xl-rtds  8 xen-boot fail REGR. vs. 182531

Tests which did not succeed, but are not blocking:
 test-armhf-armhf-libvirt-qcow2 15 saverestore-support-check fail in 182729 
like 182531
 test-armhf-armhf-libvirt-qcow2 14 migrate-support-check fail in 182729 never 
pass
 test-armhf-armhf-libvirt 16 saverestore-support-checkfail  like 182531
 test-armhf-armhf-libvirt-raw 15 saverestore-support-checkfail  like 182531
 test-arm64-arm64-xl-thunderx 15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-thunderx 16 saverestore-support-checkfail   never pass
 test-arm64-arm64-xl-credit1  15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-credit1  16 saverestore-support-checkfail   never pass
 test-arm64-arm64-xl-xsm  15 migrate-support-checkfail   never pass
 test-arm64-arm64-libvirt-xsm 15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-xsm  16 saverestore-support-checkfail   never pass
 test-arm64-arm64-libvirt-xsm 16 saverestore-support-checkfail   never pass
 test-arm64-arm64-xl  15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-credit2