Re: Graphics driver and CONFIG_ACPI

2021-11-26 Thread Taylor R Campbell
> Date: Fri, 26 Nov 2021 05:19:57 +
> From: Riza Dindir 
> 
> I do not know where to define CONFIG_ACPI. It is not being defined (as
> it seems) for radeon, but for the i915 device it is being defined. I
> could do the same thing as it is done in the i915 driver code, but
> again, I am not sure about that either.
> 
> Does anybody have an idea on where this definition (CONFIG_ACPI)
> should be defined, for radeon?

Since there's not a lot of upstream code using CONFIG_ACPI but it
tends to require manual effort to port (the Linux acpica API
is...annoyingly different from everyone else's, like changing the case
of every name and using structs instead of unions or vice versa so
it's not a simple matter of adding some typedefs and wrapper
functions), what I've done is just define it conditionally based on
NACPICA in the places where I have made the necessary adjustments.

In this case, I'd probably just put it in radeon.h:

#include "acpica.h"
#if NACPICA > 0
#define CONFIG_ACPI 1
#endif

It's not a great system but it serves for now.  If it starts getting
out of hand we can find another way to do it.

FYI: Current development on the kernel graphics stack is happening at
https://github.com/riastradh/netbsd-src in the re4drm56 branch (which
is kind of messy and is rebased and squashed often, so be prepared for
forced updates, although might be merged soon).  For radeon there's
not many differences because new upstream development is mostly
happening on amdgpu, but you might want to work on re4drm56 to avoid
duplicating effort.


Re: kaveri_mec2.bin file missing

2021-11-26 Thread Riza Dindir
Hello

Sorry for the late reply. It landed in spam for some reason. I apologize.

On Sun, Nov 21, 2021 at 5:54 PM Robert Swindells  wrote:
>
>
> Riza Dindir  wrote:
> >I have put the two files listed above (by RVP) to the
> >"src/sys/dev/microcode/radeon/" directory. I also changed the
> >configuration to only include the radeon device that is the
> >0x1002/0x1309 Kaveri device. Did add the KAVERI_mec2.bin to the
> >MODULE_FIRMWARE definitions in the radeon_cik.c file (since this was
> >missing). But this failed to load the microcode. It does fail in the
> >function "cik_init_microcode".
> >
> >I have put these bin files into "src/sys/dev/microcode/radeon/". Isn't
> >this the correct path to put these bin files in?
>
> It is the correct source directory for Radeon microcode files, unless
> you have added something to the Makefile they won't get copied to
> the destination directory which is /libdata/firmware/radeon.

I have done that but they did not get copied to the /libdata
directory. I do not know when the makefile in the
src/sys/dev/microcode/radeon directory is being invoked.

>
> You could just copy files from the linux-firmware tree to
> /libdata/firmware/radeon to test things.

Yes I manually copied these files and it worked.

>
> >Are the file names in this directory case-sensitive? Although in the
> >"src/sys/dev/microcode/radeon/" directory all the bin files begin with
> >capital letters (KAVERI_mec.bin for instance).
>
> The filenames are case sensitive, you can see that the files are not the
> same.
>
> % diff -b KAVERI_me.bin kaveri_me.bin
> Binary files KAVERI_me.bin and kaveri_me.bin differ
>
> I would expect to use either the KAVERI* or the kaveri* files as a set.

On examining the radeok_cik.c file in the cik_init_microcode()
function (or something like that) it looks for the KAVERI*, then the
kaveri* files. As far as I can tell the kaveri* files are the new
firmware. You have to have all the kaveri* files in the libdata
directory, so that it will use all the new firmware, otherwise it
complains that old and new firmware is being mixed.

Thanks for the response.

Riza


Re: kaveri_mec2.bin file missing

2021-11-26 Thread Riza Dindir
Hello

On Thu, Nov 25, 2021 at 8:22 PM matthew green  wrote:
>
> Riza Dindir writes:
> > Hello All,
> >
> > Finally... I was able to enable and use my Kaveri device
> > (0x1002/0x1309), at the end. It is using the external monitor and is
> > using the correct 1440x900 resolution. This is very nice.
> >
> > There is one thing that I would like to ask.
> >
> > There is a "CONFIG_ACPI" definition that is being used in the
> > radeon_bios file. I looked for this definition in the sources and
> > found that "sys/external/bsd/drm2/dist/drm/i915/i915_drv.h" has this
> > definition (that is the only place).
> >
> > I wanted to copy or do something similar in the radeon driver. But I
> > was not sure. Then I checked at runtime definitions CONFIG_ACPI and
> > NACPICA (as used in the i915 driver). The NACPICA has a value and is >
> > 0. And CONFIG_ACPI is not defined, as seen below.
> >
> >   [10.911949] kern info: [drm] CONFIG_ACPI not set
> >   [10.920577] kern info: [drm] NACPICA > 0
> >
> > Do you have any ideas on why CONFIG_ACPI is not defined in radeon?
> > (Maybe this is not the correct place to ask this question).
>
> the ACPI code in the drm code base requires porting to netbsd,
> for both the radeon and the nouveau drivers.  it's been a while
> since i was looking at it (i had nouveau compiling at some
> point).  ie, it's not enabled because it doesn't compile there,
> it is only enabled on i915 because it does there.

I see. Might try defining CONFIG_ACPI.

>
> > If I were to submit patches, how can I submit these, where?
>
> sending patches to this list is good.
>
> (there's also tech-x11@ but this stuff is relevant for the
> console and other operations that don't need X, and is about
> the kernel side..)

Yes I will do. The code boiled down to using some functions defined in
the acpica.h files in the netbsd code (AcpiGetTable). Although the new
porting efforts use the new linux kernel code, which has
acpi_get_table, which might even work without modifications, given
that CONFIG_ACPI is defined.

>
> thanks.
>
>
> .mrg.

Regards
Riza


Re: Graphics driver and CONFIG_ACPI

2021-11-26 Thread Riza Dindir
Hello,

On Fri, Nov 26, 2021 at 11:09 AM Taylor R Campbell
 wrote:
>
> > Date: Fri, 26 Nov 2021 05:19:57 +
> > From: Riza Dindir 
> >
> > I do not know where to define CONFIG_ACPI. It is not being defined (as
> > it seems) for radeon, but for the i915 device it is being defined. I
> > could do the same thing as it is done in the i915 driver code, but
> > again, I am not sure about that either.
> >
> > Does anybody have an idea on where this definition (CONFIG_ACPI)
> > should be defined, for radeon?
>
> Since there's not a lot of upstream code using CONFIG_ACPI but it
> tends to require manual effort to port (the Linux acpica API
> is...annoyingly different from everyone else's, like changing the case
> of every name and using structs instead of unions or vice versa so
> it's not a simple matter of adding some typedefs and wrapper
> functions), what I've done is just define it conditionally based on
> NACPICA in the places where I have made the necessary adjustments.
>
> In this case, I'd probably just put it in radeon.h:
>
> #include "acpica.h"
> #if NACPICA > 0
> #define CONFIG_ACPI 1
> #endif
>
> It's not a great system but it serves for now.  If it starts getting
> out of hand we can find another way to do it.

Will do that. Was not sure of doing that.

>
> FYI: Current development on the kernel graphics stack is happening at
> https://github.com/riastradh/netbsd-src in the re4drm56 branch (which
> is kind of messy and is rebased and squashed often, so be prepared for
> forced updates, although might be merged soon).  For radeon there's
> not many differences because new upstream development is mostly
> happening on amdgpu, but you might want to work on re4drm56 to avoid
> duplicating effort.

OK. I will be checking out that code, and try building the kernel, and
go from there.

Regards,
Riza