diff mbox series

[v4,3/4] xen: Add files needed for minimal riscv build

Message ID 88ca49cea8dc0c44604957d42722388bb3d9e3ff.1621712830.git.connojdavis@gmail.com (mailing list archive)
State Superseded
Headers show
Series Minimal build for RISCV | expand

Commit Message

Connor Davis May 24, 2021, 2:34 p.m. UTC
Add arch-specific makefiles and configs needed to build for
riscv. Also add a minimal head.S that is a simple infinite loop.
head.o can be built with

$ make XEN_TARGET_ARCH=riscv SUBSYSTEMS=xen -C xen tiny64_defconfig
$ make XEN_TARGET_ARCH=riscv SUBSYSTEMS=xen -C xen TARGET=head.o

No other TARGET is supported at the moment.

Signed-off-by: Connor Davis <connojdavis@gmail.com>
---
 config/riscv.mk                         |  4 +++
 xen/Makefile                            |  8 +++--
 xen/arch/riscv/Kconfig                  | 47 +++++++++++++++++++++++++
 xen/arch/riscv/Kconfig.debug            |  0
 xen/arch/riscv/Makefile                 |  0
 xen/arch/riscv/Rules.mk                 |  0
 xen/arch/riscv/arch.mk                  | 14 ++++++++
 xen/arch/riscv/asm-offsets.c            |  0
 xen/arch/riscv/configs/tiny64_defconfig | 13 +++++++
 xen/arch/riscv/head.S                   |  6 ++++
 xen/include/asm-riscv/config.h          | 47 +++++++++++++++++++++++++
 11 files changed, 137 insertions(+), 2 deletions(-)
 create mode 100644 config/riscv.mk
 create mode 100644 xen/arch/riscv/Kconfig
 create mode 100644 xen/arch/riscv/Kconfig.debug
 create mode 100644 xen/arch/riscv/Makefile
 create mode 100644 xen/arch/riscv/Rules.mk
 create mode 100644 xen/arch/riscv/arch.mk
 create mode 100644 xen/arch/riscv/asm-offsets.c
 create mode 100644 xen/arch/riscv/configs/tiny64_defconfig
 create mode 100644 xen/arch/riscv/head.S
 create mode 100644 xen/include/asm-riscv/config.h

Comments

Jan Beulich May 25, 2021, 8:48 a.m. UTC | #1
On 24.05.2021 16:34, Connor Davis wrote:
> Add arch-specific makefiles and configs needed to build for
> riscv. Also add a minimal head.S that is a simple infinite loop.
> head.o can be built with
> 
> $ make XEN_TARGET_ARCH=riscv SUBSYSTEMS=xen -C xen tiny64_defconfig
> $ make XEN_TARGET_ARCH=riscv SUBSYSTEMS=xen -C xen TARGET=head.o
> 
> No other TARGET is supported at the moment.
> 
> Signed-off-by: Connor Davis <connojdavis@gmail.com>
> ---
>  config/riscv.mk                         |  4 +++
>  xen/Makefile                            |  8 +++--
>  xen/arch/riscv/Kconfig                  | 47 +++++++++++++++++++++++++
>  xen/arch/riscv/Kconfig.debug            |  0
>  xen/arch/riscv/Makefile                 |  0
>  xen/arch/riscv/Rules.mk                 |  0
>  xen/arch/riscv/arch.mk                  | 14 ++++++++
>  xen/arch/riscv/asm-offsets.c            |  0
>  xen/arch/riscv/configs/tiny64_defconfig | 13 +++++++
>  xen/arch/riscv/head.S                   |  6 ++++
>  xen/include/asm-riscv/config.h          | 47 +++++++++++++++++++++++++
>  11 files changed, 137 insertions(+), 2 deletions(-)
>  create mode 100644 config/riscv.mk
>  create mode 100644 xen/arch/riscv/Kconfig
>  create mode 100644 xen/arch/riscv/Kconfig.debug
>  create mode 100644 xen/arch/riscv/Makefile
>  create mode 100644 xen/arch/riscv/Rules.mk
>  create mode 100644 xen/arch/riscv/arch.mk
>  create mode 100644 xen/arch/riscv/asm-offsets.c
>  create mode 100644 xen/arch/riscv/configs/tiny64_defconfig
>  create mode 100644 xen/arch/riscv/head.S
>  create mode 100644 xen/include/asm-riscv/config.h

I think this wants to be accompanied by an addition to ./MAINTAINERS
right away, such that future RISC-V patches can be acked by the
respective designated maintainers, rather than falling under "THE REST".
Question is whether you / we have settled yet who's to become arch
maintainer there.

Jan
Bobby Eshleman May 25, 2021, 6:13 p.m. UTC | #2
On 5/25/21 1:48 AM, Jan Beulich wrote:
> On 24.05.2021 16:34, Connor Davis wrote:
>> Add arch-specific makefiles and configs needed to build for
>> riscv. Also add a minimal head.S that is a simple infinite loop.
>> head.o can be built with
>>
>> $ make XEN_TARGET_ARCH=riscv SUBSYSTEMS=xen -C xen tiny64_defconfig
>> $ make XEN_TARGET_ARCH=riscv SUBSYSTEMS=xen -C xen TARGET=head.o
>>
>> No other TARGET is supported at the moment.
>>
>> Signed-off-by: Connor Davis <connojdavis@gmail.com>
>> ---
>>  config/riscv.mk                         |  4 +++
>>  xen/Makefile                            |  8 +++--
>>  xen/arch/riscv/Kconfig                  | 47 +++++++++++++++++++++++++
>>  xen/arch/riscv/Kconfig.debug            |  0
>>  xen/arch/riscv/Makefile                 |  0
>>  xen/arch/riscv/Rules.mk                 |  0
>>  xen/arch/riscv/arch.mk                  | 14 ++++++++
>>  xen/arch/riscv/asm-offsets.c            |  0
>>  xen/arch/riscv/configs/tiny64_defconfig | 13 +++++++
>>  xen/arch/riscv/head.S                   |  6 ++++
>>  xen/include/asm-riscv/config.h          | 47 +++++++++++++++++++++++++
>>  11 files changed, 137 insertions(+), 2 deletions(-)
>>  create mode 100644 config/riscv.mk
>>  create mode 100644 xen/arch/riscv/Kconfig
>>  create mode 100644 xen/arch/riscv/Kconfig.debug
>>  create mode 100644 xen/arch/riscv/Makefile
>>  create mode 100644 xen/arch/riscv/Rules.mk
>>  create mode 100644 xen/arch/riscv/arch.mk
>>  create mode 100644 xen/arch/riscv/asm-offsets.c
>>  create mode 100644 xen/arch/riscv/configs/tiny64_defconfig
>>  create mode 100644 xen/arch/riscv/head.S
>>  create mode 100644 xen/include/asm-riscv/config.h
> 
> I think this wants to be accompanied by an addition to ./MAINTAINERS
> right away, such that future RISC-V patches can be acked by the
> respective designated maintainers, rather than falling under "THE REST".
> Question is whether you / we have settled yet who's to become arch
> maintainer there.
> 
> Jan
> 

I'd like to volunteer myself for this, as I'm slated to continue
with the port indefinitely and would at least like to review
patches.  If Connor has the time, I think it makes sense for him
to be listed there too.

Until we have others (it's just us two right now), it'll be a
lot of us reviewing each other's arch-specific work (in addition to
reviewers elsewhere in the Xen project, of course).

-Bobby
Connor Davis June 1, 2021, 2:26 a.m. UTC | #3
On 5/25/21 12:13 PM, Bob Eshleman wrote:
> On 5/25/21 1:48 AM, Jan Beulich wrote:
>> On 24.05.2021 16:34, Connor Davis wrote:
>>> Add arch-specific makefiles and configs needed to build for
>>> riscv. Also add a minimal head.S that is a simple infinite loop.
>>> head.o can be built with
>>>
>>> $ make XEN_TARGET_ARCH=riscv SUBSYSTEMS=xen -C xen tiny64_defconfig
>>> $ make XEN_TARGET_ARCH=riscv SUBSYSTEMS=xen -C xen TARGET=head.o
>>>
>>> No other TARGET is supported at the moment.
>>>
>>> Signed-off-by: Connor Davis <connojdavis@gmail.com>
>>> ---
>>>   config/riscv.mk                         |  4 +++
>>>   xen/Makefile                            |  8 +++--
>>>   xen/arch/riscv/Kconfig                  | 47 +++++++++++++++++++++++++
>>>   xen/arch/riscv/Kconfig.debug            |  0
>>>   xen/arch/riscv/Makefile                 |  0
>>>   xen/arch/riscv/Rules.mk                 |  0
>>>   xen/arch/riscv/arch.mk                  | 14 ++++++++
>>>   xen/arch/riscv/asm-offsets.c            |  0
>>>   xen/arch/riscv/configs/tiny64_defconfig | 13 +++++++
>>>   xen/arch/riscv/head.S                   |  6 ++++
>>>   xen/include/asm-riscv/config.h          | 47 +++++++++++++++++++++++++
>>>   11 files changed, 137 insertions(+), 2 deletions(-)
>>>   create mode 100644 config/riscv.mk
>>>   create mode 100644 xen/arch/riscv/Kconfig
>>>   create mode 100644 xen/arch/riscv/Kconfig.debug
>>>   create mode 100644 xen/arch/riscv/Makefile
>>>   create mode 100644 xen/arch/riscv/Rules.mk
>>>   create mode 100644 xen/arch/riscv/arch.mk
>>>   create mode 100644 xen/arch/riscv/asm-offsets.c
>>>   create mode 100644 xen/arch/riscv/configs/tiny64_defconfig
>>>   create mode 100644 xen/arch/riscv/head.S
>>>   create mode 100644 xen/include/asm-riscv/config.h
>> I think this wants to be accompanied by an addition to ./MAINTAINERS
>> right away, such that future RISC-V patches can be acked by the
>> respective designated maintainers, rather than falling under "THE REST".
>> Question is whether you / we have settled yet who's to become arch
>> maintainer there.
>>
>> Jan
>>
> I'd like to volunteer myself for this, as I'm slated to continue
> with the port indefinitely and would at least like to review
> patches.  If Connor has the time, I think it makes sense for him
> to be listed there too.
>
> Until we have others (it's just us two right now), it'll be a
> lot of us reviewing each other's arch-specific work (in addition to
> reviewers elsewhere in the Xen project, of course).
>
> -Bobby
>
Jan: can you list Bobby as the maintainer on commit? You can list me as 
well,
but I can't guarantee a time commitment unlike Bobby.

Thanks,
Connor
Jan Beulich June 1, 2021, 6:03 a.m. UTC | #4
On 01.06.2021 04:26, Connor Davis wrote:
> 
> 
> On 5/25/21 12:13 PM, Bob Eshleman wrote:
>> On 5/25/21 1:48 AM, Jan Beulich wrote:
>>> On 24.05.2021 16:34, Connor Davis wrote:
>>>> Add arch-specific makefiles and configs needed to build for
>>>> riscv. Also add a minimal head.S that is a simple infinite loop.
>>>> head.o can be built with
>>>>
>>>> $ make XEN_TARGET_ARCH=riscv SUBSYSTEMS=xen -C xen tiny64_defconfig
>>>> $ make XEN_TARGET_ARCH=riscv SUBSYSTEMS=xen -C xen TARGET=head.o
>>>>
>>>> No other TARGET is supported at the moment.
>>>>
>>>> Signed-off-by: Connor Davis <connojdavis@gmail.com>
>>>> ---
>>>>   config/riscv.mk                         |  4 +++
>>>>   xen/Makefile                            |  8 +++--
>>>>   xen/arch/riscv/Kconfig                  | 47 +++++++++++++++++++++++++
>>>>   xen/arch/riscv/Kconfig.debug            |  0
>>>>   xen/arch/riscv/Makefile                 |  0
>>>>   xen/arch/riscv/Rules.mk                 |  0
>>>>   xen/arch/riscv/arch.mk                  | 14 ++++++++
>>>>   xen/arch/riscv/asm-offsets.c            |  0
>>>>   xen/arch/riscv/configs/tiny64_defconfig | 13 +++++++
>>>>   xen/arch/riscv/head.S                   |  6 ++++
>>>>   xen/include/asm-riscv/config.h          | 47 +++++++++++++++++++++++++
>>>>   11 files changed, 137 insertions(+), 2 deletions(-)
>>>>   create mode 100644 config/riscv.mk
>>>>   create mode 100644 xen/arch/riscv/Kconfig
>>>>   create mode 100644 xen/arch/riscv/Kconfig.debug
>>>>   create mode 100644 xen/arch/riscv/Makefile
>>>>   create mode 100644 xen/arch/riscv/Rules.mk
>>>>   create mode 100644 xen/arch/riscv/arch.mk
>>>>   create mode 100644 xen/arch/riscv/asm-offsets.c
>>>>   create mode 100644 xen/arch/riscv/configs/tiny64_defconfig
>>>>   create mode 100644 xen/arch/riscv/head.S
>>>>   create mode 100644 xen/include/asm-riscv/config.h
>>> I think this wants to be accompanied by an addition to ./MAINTAINERS
>>> right away, such that future RISC-V patches can be acked by the
>>> respective designated maintainers, rather than falling under "THE REST".
>>> Question is whether you / we have settled yet who's to become arch
>>> maintainer there.
>>>
>>> Jan
>>>
>> I'd like to volunteer myself for this, as I'm slated to continue
>> with the port indefinitely and would at least like to review
>> patches.  If Connor has the time, I think it makes sense for him
>> to be listed there too.
>>
>> Until we have others (it's just us two right now), it'll be a
>> lot of us reviewing each other's arch-specific work (in addition to
>> reviewers elsewhere in the Xen project, of course).
>>
>> -Bobby
>>
> Jan: can you list Bobby as the maintainer on commit? You can list me as 
> well,
> but I can't guarantee a time commitment unlike Bobby.

Well, actually I did expect a v5 submission with whatever entry you
both deem suitable. Otoh I now realize that patch 1 had my extra
request addressed (by myself) and hence with this one needing just
that entry, I could indeed add that addition myself while committing.
Let me move the mails back to the to-be-committed folder...

Jan
Jan Beulich June 1, 2021, 6:11 a.m. UTC | #5
On 24.05.2021 16:34, Connor Davis wrote:
> Add arch-specific makefiles and configs needed to build for
> riscv. Also add a minimal head.S that is a simple infinite loop.
> head.o can be built with
> 
> $ make XEN_TARGET_ARCH=riscv SUBSYSTEMS=xen -C xen tiny64_defconfig
> $ make XEN_TARGET_ARCH=riscv SUBSYSTEMS=xen -C xen TARGET=head.o
> 
> No other TARGET is supported at the moment.

Just to confirm - an actual (even if not functioning) xen binary can't
be linked yet? I ask because that would be the prereq for me to set up
routine (cross) build testing, just like I do for Arm.

Jan
Julien Grall June 1, 2021, 8:40 a.m. UTC | #6
Hi,

On 01/06/2021 07:03, Jan Beulich wrote:
> On 01.06.2021 04:26, Connor Davis wrote:
>>
>>
>> On 5/25/21 12:13 PM, Bob Eshleman wrote:
>>> On 5/25/21 1:48 AM, Jan Beulich wrote:
>>>> On 24.05.2021 16:34, Connor Davis wrote:
>>>>> Add arch-specific makefiles and configs needed to build for
>>>>> riscv. Also add a minimal head.S that is a simple infinite loop.
>>>>> head.o can be built with
>>>>>
>>>>> $ make XEN_TARGET_ARCH=riscv SUBSYSTEMS=xen -C xen tiny64_defconfig
>>>>> $ make XEN_TARGET_ARCH=riscv SUBSYSTEMS=xen -C xen TARGET=head.o
>>>>>
>>>>> No other TARGET is supported at the moment.
>>>>>
>>>>> Signed-off-by: Connor Davis <connojdavis@gmail.com>
>>>>> ---
>>>>>    config/riscv.mk                         |  4 +++
>>>>>    xen/Makefile                            |  8 +++--
>>>>>    xen/arch/riscv/Kconfig                  | 47 +++++++++++++++++++++++++
>>>>>    xen/arch/riscv/Kconfig.debug            |  0
>>>>>    xen/arch/riscv/Makefile                 |  0
>>>>>    xen/arch/riscv/Rules.mk                 |  0
>>>>>    xen/arch/riscv/arch.mk                  | 14 ++++++++
>>>>>    xen/arch/riscv/asm-offsets.c            |  0
>>>>>    xen/arch/riscv/configs/tiny64_defconfig | 13 +++++++
>>>>>    xen/arch/riscv/head.S                   |  6 ++++
>>>>>    xen/include/asm-riscv/config.h          | 47 +++++++++++++++++++++++++
>>>>>    11 files changed, 137 insertions(+), 2 deletions(-)
>>>>>    create mode 100644 config/riscv.mk
>>>>>    create mode 100644 xen/arch/riscv/Kconfig
>>>>>    create mode 100644 xen/arch/riscv/Kconfig.debug
>>>>>    create mode 100644 xen/arch/riscv/Makefile
>>>>>    create mode 100644 xen/arch/riscv/Rules.mk
>>>>>    create mode 100644 xen/arch/riscv/arch.mk
>>>>>    create mode 100644 xen/arch/riscv/asm-offsets.c
>>>>>    create mode 100644 xen/arch/riscv/configs/tiny64_defconfig
>>>>>    create mode 100644 xen/arch/riscv/head.S
>>>>>    create mode 100644 xen/include/asm-riscv/config.h
>>>> I think this wants to be accompanied by an addition to ./MAINTAINERS
>>>> right away, such that future RISC-V patches can be acked by the
>>>> respective designated maintainers, rather than falling under "THE REST".
>>>> Question is whether you / we have settled yet who's to become arch
>>>> maintainer there.
>>>>
>>>> Jan
>>>>
>>> I'd like to volunteer myself for this, as I'm slated to continue
>>> with the port indefinitely and would at least like to review
>>> patches.  If Connor has the time, I think it makes sense for him
>>> to be listed there too.
>>>
>>> Until we have others (it's just us two right now), it'll be a
>>> lot of us reviewing each other's arch-specific work (in addition to
>>> reviewers elsewhere in the Xen project, of course).
>>>
>>> -Bobby
>>>
>> Jan: can you list Bobby as the maintainer on commit? You can list me as
>> well,
>> but I can't guarantee a time commitment unlike Bobby.
> 
> Well, actually I did expect a v5 submission with whatever entry you
> both deem suitable. Otoh I now realize that patch 1 had my extra
> request addressed (by myself) and hence with this one needing just
> that entry, I could indeed add that addition myself while committing.
> Let me move the mails back to the to-be-committed folder...

At the risk of being picky, I don't think this should be done of commit. 
Instead, a formal patch should be sent with both maintainers + one of 
the committer acking (or signed-off-by) the proposal.

Cheers,
Connor Davis June 2, 2021, 2:12 a.m. UTC | #7
On 6/1/21 12:11 AM, Jan Beulich wrote:
> On 24.05.2021 16:34, Connor Davis wrote:
>> Add arch-specific makefiles and configs needed to build for
>> riscv. Also add a minimal head.S that is a simple infinite loop.
>> head.o can be built with
>>
>> $ make XEN_TARGET_ARCH=riscv SUBSYSTEMS=xen -C xen tiny64_defconfig
>> $ make XEN_TARGET_ARCH=riscv SUBSYSTEMS=xen -C xen TARGET=head.o
>>
>> No other TARGET is supported at the moment.
> Just to confirm - an actual (even if not functioning) xen binary can't
> be linked yet? I ask because that would be the prereq for me to set up
> routine (cross) build testing, just like I do for Arm.

That's right. The consensus was that targets and files should be added
incrementally, so I stopped at head.o for now.

Thanks,
Connor
Connor Davis June 2, 2021, 2:13 a.m. UTC | #8
On 6/1/21 2:40 AM, Julien Grall wrote:
> Hi,
>
> On 01/06/2021 07:03, Jan Beulich wrote:
>> On 01.06.2021 04:26, Connor Davis wrote:
>>>
>>>
>>> On 5/25/21 12:13 PM, Bob Eshleman wrote:
>>>> On 5/25/21 1:48 AM, Jan Beulich wrote:
>>>>> On 24.05.2021 16:34, Connor Davis wrote:
>>>>>> Add arch-specific makefiles and configs needed to build for
>>>>>> riscv. Also add a minimal head.S that is a simple infinite loop.
>>>>>> head.o can be built with
>>>>>>
>>>>>> $ make XEN_TARGET_ARCH=riscv SUBSYSTEMS=xen -C xen tiny64_defconfig
>>>>>> $ make XEN_TARGET_ARCH=riscv SUBSYSTEMS=xen -C xen TARGET=head.o
>>>>>>
>>>>>> No other TARGET is supported at the moment.
>>>>>>
>>>>>> Signed-off-by: Connor Davis <connojdavis@gmail.com>
>>>>>> ---
>>>>>>    config/riscv.mk                         |  4 +++
>>>>>>    xen/Makefile                            |  8 +++--
>>>>>>    xen/arch/riscv/Kconfig                  | 47 
>>>>>> +++++++++++++++++++++++++
>>>>>>    xen/arch/riscv/Kconfig.debug            |  0
>>>>>>    xen/arch/riscv/Makefile                 |  0
>>>>>>    xen/arch/riscv/Rules.mk                 |  0
>>>>>>    xen/arch/riscv/arch.mk                  | 14 ++++++++
>>>>>>    xen/arch/riscv/asm-offsets.c            |  0
>>>>>>    xen/arch/riscv/configs/tiny64_defconfig | 13 +++++++
>>>>>>    xen/arch/riscv/head.S                   |  6 ++++
>>>>>>    xen/include/asm-riscv/config.h          | 47 
>>>>>> +++++++++++++++++++++++++
>>>>>>    11 files changed, 137 insertions(+), 2 deletions(-)
>>>>>>    create mode 100644 config/riscv.mk
>>>>>>    create mode 100644 xen/arch/riscv/Kconfig
>>>>>>    create mode 100644 xen/arch/riscv/Kconfig.debug
>>>>>>    create mode 100644 xen/arch/riscv/Makefile
>>>>>>    create mode 100644 xen/arch/riscv/Rules.mk
>>>>>>    create mode 100644 xen/arch/riscv/arch.mk
>>>>>>    create mode 100644 xen/arch/riscv/asm-offsets.c
>>>>>>    create mode 100644 xen/arch/riscv/configs/tiny64_defconfig
>>>>>>    create mode 100644 xen/arch/riscv/head.S
>>>>>>    create mode 100644 xen/include/asm-riscv/config.h
>>>>> I think this wants to be accompanied by an addition to ./MAINTAINERS
>>>>> right away, such that future RISC-V patches can be acked by the
>>>>> respective designated maintainers, rather than falling under "THE 
>>>>> REST".
>>>>> Question is whether you / we have settled yet who's to become arch
>>>>> maintainer there.
>>>>>
>>>>> Jan
>>>>>
>>>> I'd like to volunteer myself for this, as I'm slated to continue
>>>> with the port indefinitely and would at least like to review
>>>> patches.  If Connor has the time, I think it makes sense for him
>>>> to be listed there too.
>>>>
>>>> Until we have others (it's just us two right now), it'll be a
>>>> lot of us reviewing each other's arch-specific work (in addition to
>>>> reviewers elsewhere in the Xen project, of course).
>>>>
>>>> -Bobby
>>>>
>>> Jan: can you list Bobby as the maintainer on commit? You can list me as
>>> well,
>>> but I can't guarantee a time commitment unlike Bobby.
>>
>> Well, actually I did expect a v5 submission with whatever entry you
>> both deem suitable. Otoh I now realize that patch 1 had my extra
>> request addressed (by myself) and hence with this one needing just
>> that entry, I could indeed add that addition myself while committing.
>> Let me move the mails back to the to-be-committed folder...
>
> At the risk of being picky, I don't think this should be done of 
> commit. Instead, a formal patch should be sent with both maintainers + 
> one of the committer acking (or signed-off-by) the proposal.

No problem, I will send a v5.

Thanks,
Connor
Alistair Francis June 3, 2021, 11:26 p.m. UTC | #9
On Tue, Jun 1, 2021 at 12:26 PM Connor Davis <connojdavis@gmail.com> wrote:
>
>
>
> On 5/25/21 12:13 PM, Bob Eshleman wrote:
> > On 5/25/21 1:48 AM, Jan Beulich wrote:
> >> On 24.05.2021 16:34, Connor Davis wrote:
> >>> Add arch-specific makefiles and configs needed to build for
> >>> riscv. Also add a minimal head.S that is a simple infinite loop.
> >>> head.o can be built with
> >>>
> >>> $ make XEN_TARGET_ARCH=riscv SUBSYSTEMS=xen -C xen tiny64_defconfig
> >>> $ make XEN_TARGET_ARCH=riscv SUBSYSTEMS=xen -C xen TARGET=head.o
> >>>
> >>> No other TARGET is supported at the moment.
> >>>
> >>> Signed-off-by: Connor Davis <connojdavis@gmail.com>
> >>> ---
> >>>   config/riscv.mk                         |  4 +++
> >>>   xen/Makefile                            |  8 +++--
> >>>   xen/arch/riscv/Kconfig                  | 47 +++++++++++++++++++++++++
> >>>   xen/arch/riscv/Kconfig.debug            |  0
> >>>   xen/arch/riscv/Makefile                 |  0
> >>>   xen/arch/riscv/Rules.mk                 |  0
> >>>   xen/arch/riscv/arch.mk                  | 14 ++++++++
> >>>   xen/arch/riscv/asm-offsets.c            |  0
> >>>   xen/arch/riscv/configs/tiny64_defconfig | 13 +++++++
> >>>   xen/arch/riscv/head.S                   |  6 ++++
> >>>   xen/include/asm-riscv/config.h          | 47 +++++++++++++++++++++++++
> >>>   11 files changed, 137 insertions(+), 2 deletions(-)
> >>>   create mode 100644 config/riscv.mk
> >>>   create mode 100644 xen/arch/riscv/Kconfig
> >>>   create mode 100644 xen/arch/riscv/Kconfig.debug
> >>>   create mode 100644 xen/arch/riscv/Makefile
> >>>   create mode 100644 xen/arch/riscv/Rules.mk
> >>>   create mode 100644 xen/arch/riscv/arch.mk
> >>>   create mode 100644 xen/arch/riscv/asm-offsets.c
> >>>   create mode 100644 xen/arch/riscv/configs/tiny64_defconfig
> >>>   create mode 100644 xen/arch/riscv/head.S
> >>>   create mode 100644 xen/include/asm-riscv/config.h
> >> I think this wants to be accompanied by an addition to ./MAINTAINERS
> >> right away, such that future RISC-V patches can be acked by the
> >> respective designated maintainers, rather than falling under "THE REST".
> >> Question is whether you / we have settled yet who's to become arch
> >> maintainer there.
> >>
> >> Jan
> >>
> > I'd like to volunteer myself for this, as I'm slated to continue
> > with the port indefinitely and would at least like to review
> > patches.  If Connor has the time, I think it makes sense for him
> > to be listed there too.
> >
> > Until we have others (it's just us two right now), it'll be a
> > lot of us reviewing each other's arch-specific work (in addition to
> > reviewers elsewhere in the Xen project, of course).
> >
> > -Bobby
> >
> Jan: can you list Bobby as the maintainer on commit? You can list me as
> well,
> but I can't guarantee a time commitment unlike Bobby.

If you need more people you can add me as well. I don't have too much
time to spend here, but I did start the initial Xen port and have a
good understanding of the RISC-V Hypervisor extension.

Alistair

>
> Thanks,
> Connor
>
diff mbox series

Patch

diff --git a/config/riscv.mk b/config/riscv.mk
new file mode 100644
index 0000000000..2b2cc2e63a
--- /dev/null
+++ b/config/riscv.mk
@@ -0,0 +1,4 @@ 
+CONFIG_RISCV := y
+CONFIG_RISCV_$(XEN_OS) := y
+
+CONFIG_XEN_INSTALL_SUFFIX :=
diff --git a/xen/Makefile b/xen/Makefile
index 9f3be7766d..3a1ff0045b 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -26,7 +26,9 @@  MAKEFLAGS += -rR
 EFI_MOUNTPOINT ?= $(BOOT_DIR)/efi
 
 ARCH=$(XEN_TARGET_ARCH)
-SRCARCH=$(shell echo $(ARCH) | sed -e 's/x86.*/x86/' -e s'/arm\(32\|64\)/arm/g')
+SRCARCH=$(shell echo $(ARCH) | \
+          sed -e 's/x86.*/x86/' -e s'/arm\(32\|64\)/arm/g' \
+              -e s'/riscv.*/riscv/g')
 
 # Don't break if the build process wasn't called from the top level
 # we need XEN_TARGET_ARCH to generate the proper config
@@ -35,7 +37,8 @@  include $(XEN_ROOT)/Config.mk
 # Set ARCH/SUBARCH appropriately.
 export TARGET_SUBARCH  := $(XEN_TARGET_ARCH)
 export TARGET_ARCH     := $(shell echo $(XEN_TARGET_ARCH) | \
-                            sed -e 's/x86.*/x86/' -e s'/arm\(32\|64\)/arm/g')
+                            sed -e 's/x86.*/x86/' -e s'/arm\(32\|64\)/arm/g' \
+                                -e s'/riscv.*/riscv/g')
 
 # Allow someone to change their config file
 export KCONFIG_CONFIG ?= .config
@@ -335,6 +338,7 @@  _clean: delete-unfresh-files
 	$(MAKE) $(clean) xsm
 	$(MAKE) $(clean) crypto
 	$(MAKE) $(clean) arch/arm
+	$(MAKE) $(clean) arch/riscv
 	$(MAKE) $(clean) arch/x86
 	$(MAKE) $(clean) test
 	$(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) SRCARCH=$(SRCARCH) clean
diff --git a/xen/arch/riscv/Kconfig b/xen/arch/riscv/Kconfig
new file mode 100644
index 0000000000..bd8381c5e0
--- /dev/null
+++ b/xen/arch/riscv/Kconfig
@@ -0,0 +1,47 @@ 
+config RISCV
+	def_bool y
+
+config RISCV_64
+	def_bool y
+	select 64BIT
+
+config ARCH_DEFCONFIG
+	string
+	default "arch/riscv/configs/tiny64_defconfig"
+
+menu "Architecture Features"
+
+source "arch/Kconfig"
+
+endmenu
+
+menu "ISA Selection"
+
+choice
+	prompt "Base ISA"
+	default RISCV_ISA_RV64IMA if RISCV_64
+	help
+	  This selects the base ISA extensions that Xen will target.
+
+config RISCV_ISA_RV64IMA
+	bool "RV64IMA"
+	help
+	  Use the RV64I base ISA, plus the "M" and "A" extensions
+	  for integer multiply/divide and atomic instructions, respectively.
+
+endchoice
+
+config RISCV_ISA_C
+	bool "Compressed extension"
+	help
+	  Add "C" to the ISA subsets that the toolchain is allowed to
+	  emit when building Xen, which results in compressed instructions
+	  in the Xen binary.
+
+	  If unsure, say N.
+
+endmenu
+
+source "common/Kconfig"
+
+source "drivers/Kconfig"
diff --git a/xen/arch/riscv/Kconfig.debug b/xen/arch/riscv/Kconfig.debug
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/xen/arch/riscv/Makefile b/xen/arch/riscv/Makefile
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/xen/arch/riscv/Rules.mk b/xen/arch/riscv/Rules.mk
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/xen/arch/riscv/arch.mk b/xen/arch/riscv/arch.mk
new file mode 100644
index 0000000000..53dadb8975
--- /dev/null
+++ b/xen/arch/riscv/arch.mk
@@ -0,0 +1,14 @@ 
+########################################
+# RISCV-specific definitions
+
+CFLAGS-$(CONFIG_RISCV_64) += -mabi=lp64
+
+riscv-march-$(CONFIG_RISCV_ISA_RV64IMA) := rv64ima
+riscv-march-$(CONFIG_RISCV_ISA_C)       := $(riscv-march-y)c
+
+# Note that -mcmodel=medany is used so that Xen can be mapped
+# into the upper half _or_ the lower half of the address space.
+# -mcmodel=medlow would force Xen into the lower half.
+
+CFLAGS += -march=$(riscv-march-y) -mstrict-align -mcmodel=medany
+CFLAGS += -I$(BASEDIR)/include
diff --git a/xen/arch/riscv/asm-offsets.c b/xen/arch/riscv/asm-offsets.c
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/xen/arch/riscv/configs/tiny64_defconfig b/xen/arch/riscv/configs/tiny64_defconfig
new file mode 100644
index 0000000000..3c9a2ff941
--- /dev/null
+++ b/xen/arch/riscv/configs/tiny64_defconfig
@@ -0,0 +1,13 @@ 
+# CONFIG_SCHED_CREDIT is not set
+# CONFIG_SCHED_RTDS is not set
+# CONFIG_SCHED_NULL is not set
+# CONFIG_SCHED_ARINC653 is not set
+# CONFIG_TRACEBUFFER is not set
+# CONFIG_HYPFS is not set
+# CONFIG_GRANT_TABLE is not set
+# CONFIG_SPECULATIVE_HARDEN_ARRAY is not set
+
+CONFIG_RISCV_64=y
+CONFIG_DEBUG=y
+CONFIG_DEBUG_INFO=y
+CONFIG_EXPERT=y
diff --git a/xen/arch/riscv/head.S b/xen/arch/riscv/head.S
new file mode 100644
index 0000000000..0dbc27ba75
--- /dev/null
+++ b/xen/arch/riscv/head.S
@@ -0,0 +1,6 @@ 
+#include <asm/config.h>
+
+        .text
+
+ENTRY(start)
+        j  start
diff --git a/xen/include/asm-riscv/config.h b/xen/include/asm-riscv/config.h
new file mode 100644
index 0000000000..e2ae21de61
--- /dev/null
+++ b/xen/include/asm-riscv/config.h
@@ -0,0 +1,47 @@ 
+#ifndef __RISCV_CONFIG_H__
+#define __RISCV_CONFIG_H__
+
+#if defined(CONFIG_RISCV_64)
+# define LONG_BYTEORDER 3
+# define ELFSIZE 64
+# define MAX_VIRT_CPUS 128u
+#else
+# error "Unsupported RISCV variant"
+#endif
+
+#define BYTES_PER_LONG (1 << LONG_BYTEORDER)
+#define BITS_PER_LONG  (BYTES_PER_LONG << 3)
+#define POINTER_ALIGN  BYTES_PER_LONG
+
+#define BITS_PER_LLONG 64
+
+/* xen_ulong_t is always 64 bits */
+#define BITS_PER_XEN_ULONG 64
+
+#define CONFIG_RISCV_L1_CACHE_SHIFT 6
+#define CONFIG_PAGEALLOC_MAX_ORDER  18
+#define CONFIG_DOMU_MAX_ORDER       9
+#define CONFIG_HWDOM_MAX_ORDER      10
+
+#define OPT_CONSOLE_STR "dtuart"
+#define INVALID_VCPU_ID MAX_VIRT_CPUS
+
+/* Linkage for RISCV */
+#ifdef __ASSEMBLY__
+#define ALIGN .align 2
+
+#define ENTRY(name)                                \
+  .globl name;                                     \
+  ALIGN;                                           \
+  name:
+#endif
+
+#endif /* __RISCV_CONFIG_H__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */