qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Li Zhijian <lizhijian@cn.fujitsu.com>
Cc: qemu-devel@nongnu.org, peter.maydell@linaro.org,
	philip.li@intel.com, zhijianx.li@intel.com
Subject: Re: [Qemu-devel] [PATCH for-4.0 v3 3/4] i386: import bootparam.h
Date: Wed, 5 Dec 2018 10:33:55 -0500	[thread overview]
Message-ID: <20181205102233-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <f9656fba-181c-6267-648c-95dd2380043e@cn.fujitsu.com>

On Wed, Dec 05, 2018 at 06:28:11PM +0800, Li Zhijian wrote:
> Hi Michael
> 
> I cooked a draft with cp_portable to import bootparam.h, could you have a look.
> 
> diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh
> index 0a964fe..1beeceb 100755
> --- a/scripts/update-linux-headers.sh
> +++ b/scripts/update-linux-headers.sh
> @@ -44,6 +44,12 @@ cp_portable() {
>                                       -e 'linux/kernel' \
>                                       -e 'linux/sysinfo' \
>                                       -e 'asm-generic/kvm_para' \
> +                                     -e 'linux/screen_info.h' \
> +                                     -e 'linux/apm_bios.h' \
> +                                     -e 'linux/edd.h' \
> +                                     -e 'video/edid.h' \
> +                                     -e 'asm/ist.h' \
> +                                     -e 'linux/ioctl.h' \
>                                       > /dev/null
>      then
>          echo "Unexpected #include in input file $f".
> @@ -59,6 +65,8 @@ cp_portable() {
>          -e 's/__be\([0-9][0-9]*\)/uint\1_t/g' \
>          -e 's/"\(input-event-codes\.h\)"/"standard-headers\/linux\/\1"/' \
>          -e 's/<linux\/\([^>]*\)>/"standard-headers\/linux\/\1"/' \
> +        -e "s/<asm\/\([^>]*\)>/\"standard-headers\/asm-$arch\/\1\"/" \
> +        -e 's/<video\/\([^>]*\)>/"standard-headers\/video\/\1"/' \
>          -e 's/__bitwise//' \
>          -e 's/__attribute__((packed))/QEMU_PACKED/' \
>          -e 's/__inline__/inline/' \
> @@ -74,6 +82,23 @@ cp_portable() {
>          "$f" > "$to/$header";
>  }
> 
> +rm -rf "$output/include/standard-headers/linux"
> +mkdir -p "$output/include/standard-headers/linux"
> +
> +cp_bootparam()
> +{
> +    mkdir -p $output/include/standard-headers/video
> +    cp "$tmpdir"/include/linux/ioctl.h "$output/include/standard-headers/linux"
> +    cp_portable "$tmpdir"/include/linux/screen_info.h "$output/include/standard-headers/linux"
> +    cp_portable "$tmpdir/include/linux/apm_bios.h" "$output/include/standard-headers/linux"
> +    cp_portable "$tmpdir/include/linux/edd.h" "$output/include/standard-headers/linux"
> +    cp_portable "$tmpdir/include/asm/ist.h" $output/include/standard-headers/asm-$arch
> +    cp_portable "$tmpdir/include/video/edid.h" $output/include/standard-headers/video
> +
> +    # bootparam.h includes above headers
> +    cp_portable "$tmpdir/include/asm/bootparam.h" "$output/include/standard-headers/asm-$arch"
> +}
> +
>  # This will pick up non-directories too (eg "Kconfig") but we will
>  # ignore them in the next loop.
>  ARCHLIST=$(cd "$linux/arch" && echo *)
> @@ -120,6 +145,7 @@ for arch in $ARCHLIST; do
>          cp "$tmpdir/include/asm/unistd_x32.h" "$output/linux-headers/asm-x86/"
>          cp "$tmpdir/include/asm/unistd_64.h" "$output/linux-headers/asm-x86/"
>          cp_portable "$tmpdir/include/asm/kvm_para.h" "$output/include/standard-headers/asm-$arch"
> +        cp_bootparam
>      fi
>  done
> 
> @@ -163,8 +189,6 @@ cat <<EOF >$output/linux-headers/linux/virtio_ring.h
>  #include "standard-headers/linux/virtio_ring.h"
>  EOF
> 
> -rm -rf "$output/include/standard-headers/linux"
> -mkdir -p "$output/include/standard-headers/linux"
>  for i in "$tmpdir"/include/linux/*virtio*.h \
>           "$tmpdir/include/linux/qemu_fw_cfg.h" \
>           "$tmpdir/include/linux/input.h" \
> 
> Thanks
> Zhijian
> 

So arch specific asm including asm doesn't work well right now :(
You can either fix the path to ist to pull it from asm-x86,
or if you don't actually need anything in that header the
macros, you can just cut out everything around __ASSEMBLY__
with a bit of e.g. sed magic. E.g. pvrdma does this.

Something like:

# Remove everything except the macros from bootparam.h avoiding the unnecessary
# import of several video/ist/etc headers
sed  -e '/__ASSEMBLY__/,/__ASSEMBLY__/d' arch/x86/include/uapi/asm/bootparam.h

should do the job.


> 
> On 12/04/2018 04:09 PM, Li Zhijian wrote:
> 
> 
> 
> 
>     On 12/04/2018 09:06 AM, Michael S. Tsirkin wrote:
> 
>         On Mon, Dec 03, 2018 at 10:48:51PM +0800, Li Zhijian wrote:
> 
>             It provides setup_data struct and header fields
> 
>             CC: Michael S. Tsirkin <mst@redhat.com>
>             Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
> 
>         Sorry I was unclear when I said "import it from Linux".
> 
>     Sorry, it's my fault.
> 
> 
>         The way to import it is to copy the header
>         from the linux kernel by adding it to ./scripts/update-linux-headers.sh
>         and placing a copy into include/standard-headers/
> 
>         Hope that helps.
> 
>     that's really helpful.
> 
>     i wonder which type copy should i use 'cp' or 'cp_portable'
>     this header includes several sub-headers
> 
>     $ grep include  /tmp/tmp.MBF10Z9MeS/include/asm/bootparam.h
>     #include <linux/types.h>
>     #include <linux/screen_info.h>
>     #include <linux/apm_bios.h>
>     #include <linux/edd.h>
>     #include <asm/ist.h>
>     #include <video/edid.h>
> 
>     Thanks
>     Zhijian
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 

  reply	other threads:[~2018-12-05 15:34 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-03 14:48 [Qemu-devel] [PATCH for-4.0 v3 0/4] allow to load initrd below 4G for recent kernel Li Zhijian
2018-12-03 14:48 ` [Qemu-devel] [PATCH for-4.0 v3 1/4] unify len and addr type for memory/address APIs Li Zhijian
2018-12-03 14:42   ` Peter Maydell
2018-12-03 16:42   ` Richard Henderson
2018-12-04 17:40   ` Philippe Mathieu-Daudé
2018-12-06  2:09     ` Li Zhijian
2018-12-03 14:48 ` [Qemu-devel] [PATCH for-4.0 v3 2/4] refactor load_image_size Li Zhijian
2018-12-03 16:43   ` Richard Henderson
2018-12-03 14:48 ` [Qemu-devel] [PATCH for-4.0 v3 3/4] i386: import bootparam.h Li Zhijian
2018-12-03 16:44   ` Richard Henderson
2018-12-04  1:06   ` Michael S. Tsirkin
2018-12-04  8:09     ` Li Zhijian
2018-12-05 10:28       ` Li Zhijian
2018-12-05 15:33         ` Michael S. Tsirkin [this message]
2018-12-06  2:13           ` Li Zhijian
2018-12-03 14:48 ` [Qemu-devel] [PATCH for-4.0 v3 4/4] i386: allow to load initrd below 4G for recent linux Li Zhijian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181205102233-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=lizhijian@cn.fujitsu.com \
    --cc=peter.maydell@linaro.org \
    --cc=philip.li@intel.com \
    --cc=qemu-devel@nongnu.org \
    --cc=zhijianx.li@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).