Re: Must Disable ACPI to Boot -- current

2014-03-11 Thread Brynet
On Tue, Mar 11, 2014 at 04:47:39PM -0700, Dan Becker wrote:
> This error has persisted across several minor versions and is more of
> any annoyance than anything
> 
> Let me know what I can do to help -- to include offer up root shell on
> the machine
> 
> Compaq Presario v2000

What error!?



Re: Must Disable ACPI to Boot -- current

2014-03-11 Thread Brynet
On Tue, Mar 11, 2014 at 07:29:59PM -0700, Dan Becker wrote:
> This is where it hangs
> ..
> [demime 1.01d removed an attachment of type image/jpeg which had a
name of WP_20140311_19_28_44_Pro.jpg]

The list strips attachments, you should transcribe or upload the file
somewhere else.

-Bryan.



Re: ehci: kernel diagnostic assertion (reg & 0x3) == 0 failed

2014-03-29 Thread Brynet
On Sat, Mar 29, 2014 at 02:16:38PM +0100, Donovan Watteau wrote:
> On Sun, 23 Mar 2014, Mark Kettenis wrote:
> > > Date: Sun, 23 Mar 2014 17:53:47 +0100 (CET)
> > > From: Donovan Watteau 
> > > 
> > > ehci0 at pci0 dev 3 function 3 "SiS 7002 USB" rev 0x00: apic 2 int 23
> > > panic: kernel diagnostic assertion "(reg & 0x3) == 0" failed: file 
> > > "../../../
> > > arch/amd64/pci/pci_machdep.c", line 272
> > > Stopped atDebugger+0x5:   leave
> > > Debugger() at Debugger+0x5
> > > panic() at panic+0xee
> > > __assert() at __assert+0x21
> > > pci_conf_read() at pci_conf_read+0xdd

Ignoring the unaligned memory access for a moment, should ehci_pci even
be using pci_conf_*(9) here? The registers it's accessing aren't
technically part of the devices PCI configuration space.

..

> > > ehci_pci_takecontroller() at ehci_pci_takecontroller+0x6b
> > > ehci_pci_attach() at ehci_pci_attach+0x22a
> > > config_attach() at config_attach+0x1bc
> > > pci_probe_device() at pci_probe_device+0x447
> > > pci_enumerate_bus() at pci_enumerate_bus+0xe9
> > > config_attach() at config_attach+0x1bc
> > > end trace frame: 0x81edce80, count: 0
> > > RUN AT LEASE 'trace' AND 'ps' AND INCLUDE OUTPUT WHEN REPORTING THIS 
> > > PANIC!
> > > DO NOT EVEN BOTHER REPORTING THIS WITHOUT INCLUDING THAT INFORMATION!
> > > ddb> trace
> > > Debugger() at Debugger+0x5
> > > panic() at panic+0xee
> > > __assert() at __assert+0x21
> > > pci_conf_read() at pci_conf_read+0xdd
> > > ehci_pci_takecontroller() at ehci_pci_takecontroller+0x6b
> > > ehci_pci_attach() at ehci_pci_attach+0x22a
> > > config_attach() at config_attach+0x1bc
> > > pci_probe_device() at pci_probe_device+0x447
> > > pci_enumerate_bus() at pci_enumerate_bus+0xe9
> > > config_attach() at config_attach+0x1bc
> > > mainbus_attach() at mainbus_attach+0x163
> > > config_attach() at config_attach+0x1bc
> > > cpu_configure() at cpu_configure+0x17
> > > main() at main+0x41c
> > > end trace frame: 0x0, count: -14
> > > ddb> ps
> > >PID   PPID   PGRPUID  S  FLAGS  WAIT   COMMAND
> > > *0 -1  0  0  7  0x200 swapper
> > > ddb>
> > 
> > Can you send the output of pcidump -vxx from that machine?
> > 
> 
> Here you go:
> 
> ...
>  0:3:3: SiS 7002 USB
>   0x: Vendor ID: 1039 Product ID: 7002
>   0x0004: Command: 0006 Status: 0290
>   0x0008: Class: 0c Subclass: 03 Interface: 20 Revision: 00
>   0x000c: BIST: 00 Header Type: 00 Latency Timer: 20 Cache Line Size: 08
>   0x0010: BAR mem 32bit addr: 0xef002000/0x1000
>   0x0014: BAR empty ()
>   0x0018: BAR empty ()
>   0x001c: BAR empty ()
>   0x0020: BAR empty ()
>   0x0024: BAR empty ()
>   0x0028: Cardbus CIS: 
>   0x002c: Subsystem Vendor ID: 17aa Product ID: 100a
>   0x0030: Expansion ROM Base Address: 
>   0x0038: 
>   0x003c: Interrupt Pin: 04 Line: 03 Min Gnt: 00 Max Lat: 50
>   0x0050: Capability 0x01: Power Management
>   0x: 70021039 0296 0c032000 2008
>   0x0010: ef002000   
>   0x0020:    100a17aa
>   0x0030:  0050  5403
>   0x0040: 0800   
>   0x0050: c9c20001 0003 210a 
>   0x0060: 01ff2020   
>   0x0070: 0001 c000 3fff 
>   0x0080:    
>   0x0090:    
>   0x00a0:    
>   0x00b0:    
>   0x00c0:    
>   0x00d0:    
>   0x00e0:    
>   0x00f0:    

...

Of course, using bus_space(9) would have hidden this panic on
i386/amd64. :-)

-Bryan.



Re: ehci: kernel diagnostic assertion (reg & 0x3) == 0 failed

2014-03-29 Thread Brynet
On Sat, Mar 29, 2014 at 09:15:15PM -0400, Brynet wrote:
> Ignoring the unaligned memory access for a moment, should ehci_pci even
> be using pci_conf_*(9) here? The registers it's accessing aren't
> technically part of the devices PCI configuration space.
> 
> ..

Nevermind, I wasn't reading the specification properly carefully.



panic: receive 1, from kern/uipc_socket.c in soreceive().

2012-01-15 Thread Brynet
I was testing rthreads on OpenBSD/i386, using the Jan 15th snapshot I get a 
panic.

At the time I was starting chrome and moving it around with the mouse.

trace:
Debugger(d08d5098,db526db8,d08b60ac,db526db8,40) at Debugger+0x4
panic(d08b60ac,d59f8924,db526ddc,d03eef3e,d58bdc68) at panic+0x5d
soreceive(d58bdcc0,db526e88,db526e60,0,db526e84) at soreceive+0xc3b
recvit(d59f8924,f,db526f04,0,db526f84) at recvit+0x110
sys_recvmsg(d59f8924,db526f64,db526f84,d057490d,0) at sys_recvmsg+0xd4
syscall() at syscall+0x26a
--- syscall (number 1) ---
0x2:

-Bryan.

OpenBSD 5.1-beta (GENERIC) #135: Sun Jan 15 13:04:45 MST 2012
dera...@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: AMD Athlon(TM) XP 2600+ ("AuthenticAMD" 686-class, 512KB L2 cache) 1.53 
GHz
cpu0: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,MMX,FXSR,SSE,MMXX,3DNOW2,3DNOW
real mem  = 536391680 (511MB)
avail mem = 517533696 (493MB)
mainbus0 at root
bios0 at mainbus0: AT/286+ BIOS, date 06/23/05, BIOS32 rev. 0 @ 0xf1930, SMBIOS 
rev. 2.3 @ 0xf38c0 (50 entries)
bios0: vendor Award Software, Inc. version "ASUS A7V8X-X ACPI BIOS Revision 
1014 Beta 002" date 06/23/2005
bios0: ASUSTeK Computer INC. A7V8X-X
apm at bios0 function 0x15 not configured
acpi0 at bios0: rev 0
acpi0: sleep states S0 S1 S3 S4 S5
acpi0: tables DSDT FACP BOOT APIC
acpi0: wakeup devices PCI1(S4) USB0(S4) USB1(S4) USB2(S4) SU20(S4) SLAN(S4) 
PCI0(S4)
acpitimer0 at acpi0: 3579545 Hz, 32 bits
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
ioapic0 at mainbus0: apid 2 pa 0xfec0, version 3, 24 pins
ioapic0: misconfigured as apic 0, remapped to apid 2
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: apic clock running at 265MHz
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 1 (PCI1)
acpicpu0 at acpi0
acpibtn0 at acpi0: PWRB
bios0: ROM list: 0xc/0xd000
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
pchb0 at pci0 dev 0 function 0 "VIA VT8377 PCI" rev 0x80
viaagp0 at pchb0: v3
agp0 at viaagp0: aperture at 0xe000, size 0x1000
ppb0 at pci0 dev 1 function 0 "VIA VT8377 AGP" rev 0x00
pci1 at ppb0 bus 1
vga1 at pci1 dev 0 function 0 "ATI Radeon 9200 SE Sec" rev 0x01
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
radeondrm0 at vga1: apic 2 int 16
drm0 at radeondrm0
"ATI Radeon 9200 SE" rev 0x01 at pci1 dev 0 function 1 not configured
vr0 at pci0 dev 12 function 0 "VIA VT6105 RhineIII" rev 0x86: apic 2 int 19, 
address 00:19:5b:82:a1:e0
ukphy0 at vr0 phy 1: Generic IEEE 802.3u media interface, rev. 4: OUI 0x004063, 
model 0x0034
uhci0 at pci0 dev 16 function 0 "VIA VT83C572 USB" rev 0x80: apic 2 int 21
uhci1 at pci0 dev 16 function 1 "VIA VT83C572 USB" rev 0x80: apic 2 int 21
uhci2 at pci0 dev 16 function 2 "VIA VT83C572 USB" rev 0x80: apic 2 int 21
ehci0 at pci0 dev 16 function 3 "VIA VT6202 USB" rev 0x82: apic 2 int 21
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 "VIA EHCI root hub" rev 2.00/1.00 addr 1
viapm0 at pci0 dev 17 function 0 "VIA VT8235 ISA" rev 0x00: SMI
iic0 at viapm0
spdmem0 at iic0 addr 0x50: 256MB DDR SDRAM non-parity PC2700CL2.5
spdmem1 at iic0 addr 0x52: 256MB DDR SDRAM non-parity PC2700CL2.5
pciide0 at pci0 dev 17 function 1 "VIA VT82C571 IDE" rev 0x06: ATA133, channel 
0 configured to compatibility, channel 1 configured to compatibility
wd0 at pciide0 channel 0 drive 0: 
wd0: 16-sector PIO, LBA48, 76319MB, 156301488 sectors
wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 5
pciide0: channel 1 disabled (no drives)
auvia0 at pci0 dev 17 function 5 "VIA VT8233 AC97" rev 0x50: apic 2 int 22
ac97: codec id 0x41445370 (Analog Devices AD1980)
ac97: codec features headphone, 20 bit DAC, No 3D Stereo
audio0 at auvia0
usb1 at uhci0: USB revision 1.0
uhub1 at usb1 "VIA UHCI root hub" rev 1.00/1.00 addr 1
usb2 at uhci1: USB revision 1.0
uhub2 at usb2 "VIA UHCI root hub" rev 1.00/1.00 addr 1
usb3 at uhci2: USB revision 1.0
uhub3 at usb3 "VIA UHCI root hub" rev 1.00/1.00 addr 1
isa0 at mainbus0
isadma0 at isa0
com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
pckbc0 at isa0 port 0x60/5
pckbd0 at pckbc0 (kbd slot)
pckbc0: using irq 1 for kbd slot
wskbd0 at pckbd0: console keyboard, using wsdisplay0
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
it0 at isa0 port 0x2e/2: IT8712F rev 5, EC port 0x290
npx0 at isa0 port 0xf0/16: reported by CPUID; using exception 16
mtrr: Pentium Pro MTRR support
uhidev0 at uhub1 port 1 configuration 1 interface 0 "Microsoft Microsoft 
5-Button Mouse with IntelliEye(TM)" rev 1.10/3.00 addr 2
uhidev0: iclass 3/1
ums0 at uhidev0: 5 buttons, Z dir
wsmouse0 at ums0 mux 0
vscsi0 at root
scsibus0 at vscsi0: 256 targets
softraid0 at root
scsibus1 at softraid0: 256 targets
root on wd0a (fcbc9bfb1fe70847.a) swap on wd0b dump on wd0b
WARNING: / was not properly unmounted
panic: receive 1
Stopped at  Debugger+0x4:   popl%ebp
RUN AT LEAST 'trace' AND 'ps' AND INCLUDE OUTPUT WHEN REPORTING THIS PANIC!
DO NOT EVEN BOTHER REPORTING THI

G3 iMac (PowerMac4,1), unable to boot cd52.

2012-11-11 Thread Brynet
It seems that macppc snapshots are broken on this model.

The RAMDISK kernel never reaches userland, it gets as far as mounting
root (root on rd0a..) and then.. stops.

Unfortunately, I'm not sure when this started, I haven't powered on this
system since I moved.. my bad. :-)

USB device insertions/removals continue making noise, so, it's not
completely dead.

No problems with release, dmesg attached.

-Bryan.

Copyright (c) 1982, 1986, 1989, 1991, 1993
The Regents of the University of California,  All rights reserved.
Copyright (c) 1995-2012 OpenBSD. All rights reserved. http://www.OpenBSD.org

OpenBSD 5.2 (RAMDISK) #195: Mon Jul 30 17:00:39 MDT 2012
dera...@macppc.openbsd.org:/usr/src/sys/arch/macppc/compile/RAMDISK
real mem = 268435456 (256MB)
avail mem = 245751808 (234MB)
mainbus0 at root: model PowerMac4,1
cpu0 at mainbus0: 750 (Revision 0x2215): 500 MHz: 256KB backside cache
mem at mainbus0 not configured
memc0 at mainbus0: uni-n
kiic0 at memc0 offset 0xf8001000
mpcpcibr0 at mainbus0 pci: uni-north, Revision 0xff
pci0 at mpcpcibr0 bus 0
pchb0 at pci0 dev 11 function 0 "Apple Pangea AGP" rev 0x00
vgafb0 at pci0 dev 16 function 0 "ATI Rage 128 Pro" rev 0x00, mmio
wsdisplay0 at vgafb0 mux 1: console (std, vt100 emulation)
mpcpcibr1 at mainbus0 pci: uni-north, Revision 0x0
pci1 at mpcpcibr1 bus 0
pchb1 at pci1 dev 11 function 0 "Apple Pangea" rev 0x00
macobio0 at pci1 dev 23 function 0 "Apple Pangea Macio" rev 0x00
openpic0 at macobio0 offset 0x4: version 0x4614 feature 3f0302 LE
macgpio0 at macobio0 offset 0x50
macgpio1 at macgpio0 irq 47
"programmer-switch" at macgpio0 not configured
"escc-legacy" at macobio0 offset 0x12000 not configured
zsc0 at macobio0 offset 0x13000: irq 22,50
zstty0 at zsc0 channel 0
zstty1 at zsc0 channel 1
"davbus" at macobio0 offset 0x14000 not configured
"timer" at macobio0 offset 0x15000 not configured
adb0 at macobio0 offset 0x16000 irq 25: via-pmu, 0 targets
"i2c" at macobio0 offset 0x18000 not configured
wdc0 at macobio0 offset 0x1f000 irq 19: DMA
wd0 at wdc0 channel 0 driver 0: 
wd0: 16-sector PIO, LBA, 19536MB, 40011300 sectors
atapiscsi0 at wdc0 channel 0 drive 1
scsibus0 at atapiscsi0: 2 targets
cd0 at scsibus0 targ 0 lun 0:  ATAPI 5/cdrom 
removable
wd0(wdc0:0:0): using PIO mode 4, DMA mode 2
cd0(wdc0:0:1): using PIO mode 4, DMA mode 2
ohci0 at pci1 dev 24 function 0 "Apple Pangea USB" rev 0x00: irq 27, version 1.0
ohci1 at pci1 dev 25 function 0 "Apple Pangea USB" rev 0x00: irq 28, version 1.0
usb0 at ohci0: USB revsion 1.0
uhub0 at usb0 "Apple OHCI root hub" rev 1.00/1.00 addr 1
usb1 at ohci1: USB revsion 1.0
uhub1 at usb1 "Apple OHCI root hub" rev 1.00/1.00 addr 1
mpcpcibr2 at mainbus0 pci: uni-north, Revision 0x16
pci2 at mpcpcibr2 bus 0
pchb2 at pci2 dev 11 function 0 "Apple Pangea PCI" rev 0x00
"Apple Pangea FireWire" rev 0x00 at pci2 dev 14 function 0 not configured
gem0 at pci2 dev 15 function 0 "Apple Pangea GMAC" rev 0x00: irq 41, address 
00:03:93:44:39:74
bmtphy0 at gem0 phy 0: BCM5201 10/100 PHY, rev. 2
uhub2 at uhub1 port 1 "Mitsumi Electric Hub in Apple Extended USB Keyboard" rev
1.10/1.22 addr 2
uhidev0 at uhub2 port 1 configuration 1 interface 0 "Mitsumi Electric Apple
Extended USB Keyboard" rev 1.10/1.22 addr 3
uhidev0: iclass 3/1
ukbd0 at uhidev0
wskbd0 at ukbd0: console keyboard, using wsdisplay0
uhidev1 at uhub2 port 1 configuration 1 interface 1 "Mitsumi Electric Apple
Extended USB Keyboard" rev 1.10/1.22 addr 3
uhidev1: iclass 3/0, 3 report ids
uhid0 at uhidev1 reportid 2: input=1, output=0, feature=0
uhid1 at uhidev1 reportid 3: input=3, output=0, feature=0
uhidev2 at uhub2 port 3 configuration 1 interface 0 "Logitech Apple Optical USB
Mouse" rev 1.10/16.02 addr 4
uhidev2: iclass 3/1
uhid2 at uhidev2: input=3, output=0, feature=0
softraid0 at root
scsibus1 at softraid0: 256 targets
bootpath: /pci@f200/mac-io@17/ata-4@1f000/disk@1:/5.2/macppc/bsd.rd
root on rd0a swap on rd0b dump on rd0b
WARNING: clock gained 103 days -- CHECK AND RESET THE DATE!



Re: G3 iMac (PowerMac4,1), unable to boot cd52.

2012-12-19 Thread Brynet
On Thu, Dec 13, 2012 at 10:58:42PM -0500, Nick Holland wrote:
> On 12/13/12 08:56, Martin Pieuchot wrote:
> > Thanks for reporting this and sorry for the delay at fixing the issue.
> > It should be back to normal now, it was "just" a problem of matching the
> > graphic card in vgafb(4).
> > 
> > Cheers,
> > Martin
> > 
> 
> ta-da!  That did it for my machine! :)
> 
> Nick.

I finally had a chance to test this, and, success, my machine is booting
ramdisks again.. yay.

-Bryan.



Re: Kernel panic on current amd64 running under Ubuntu KVM (patch included)

2013-05-20 Thread Brynet
On Mon, May 20, 2013 at 09:16:21AM +0300, Roman Kravchuk wrote:
> I'm have problem with run OpenBSD current amd64 as guest in KVM hypervisor
> on Ubuntu server with AMD CPU.
..
> cpu0 at mainbus0: apid 0 (boot processor)
> cpu0: AMD Phenom(tm) 9550 Quad-Core Processor, 3600.53 MHz
> cpu0:
> FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CF
> LUSH,MMX,FXSR,SSE,SSE2,SSE3,CX16,POPCNT,NXE,MMXX,FFXSR,LONG,3DNOW2,3DNOW,LAHF,CM
> PLEG,SVM,AMCR8,ABM,SSE4A,MASSE,3DNOWP
> cpu0: 64KB 64b/line 2-way I-cache, 64KB 64b/line 2-way D-cache, 512KB
> 64b/line 1
> 6-way L2 cache
> cpu0: ITLB 255 4KB entries direct-mapped, 255 4MB entries direct-mapped
> cpu0: DTLB 255 4KB entries direct-mapped, 255 4MB entries direct-mapped
> kernel: protection fault trap, code=0
> Stopped at aesni_setup+0x1a0: rdmsr
> aesni_setup() at aesni setup+0x1a0
> amd64_errata() at amd64 errata+0xc9
> identifycpu() at identifycpu+0x729
> cpu attach() at cpu_attach+0x2ce
> config_attach() at config_attach+0x1d4
> mpbios_cpu() at mpbios_cpu+0x5b
> mpbios_scan() at mpbios_scan+0x355
> config_attach() at config_attach+0x1d4
> bios_attach() at bios_attach+0x296
> config_attach() at config_attach+0x1d4
> end trace frame: 0x81de9e30, count: 0
> ddb{0}>

This is another KVM bug. It's pretending to be an AMD CPU, but not
emulating one that actually exists.

-Bryan.



Re: kernel/6501: CPU frequency scaling on AMD K10/Acer Aspire laptop.

2011-01-07 Thread Brynet
On 10/27/10 00:05, gn...@cvs.openbsd.org wrote:
> Thank you very much for your problem report.
> It has the internal identification `kernel/6501'.
> The individual assigned to look at your
> report is: bugs. 
> 
>> Category:   kernel
>> Responsible:bugs
>> Synopsis:   CPU frequency scaling on AMD K10/Acer Aspire laptop.
>> Arrival-Date:   Wed Oct 27 04:00:01 GMT 2010
> 

Hi again,

I realize now this was essentially a feature request, but I'm wondering
if anyone is playing with this at all?

Alternatively, is anyone aware of some published documentation that
outlines the differences between AMD K8/K10 PowerNow/Cool'n'Quiet?

What changes are required to implement support for this on OpenBSD?

Thanks,
-Bryan.



Re: kernel/6501: CPU frequency scaling on AMD K10/Acer Aspire laptop.

2011-01-07 Thread Brynet
The following reply was made to PR kernel/6501; it has been noted by GNATS.

From: Brynet 
To: gn...@cvs.openbsd.org, b...@cvs.openbsd.org
Cc:  
Subject: Re: kernel/6501: CPU frequency scaling on AMD K10/Acer Aspire laptop.
Date: Sat, 08 Jan 2011 02:05:10 -0500

 On 10/27/10 00:05, gn...@cvs.openbsd.org wrote:
 > Thank you very much for your problem report.
 > It has the internal identification `kernel/6501'.
 > The individual assigned to look at your
 > report is: bugs. 
 > 
 >> Category:   kernel
 >> Responsible:bugs
 >> Synopsis:   CPU frequency scaling on AMD K10/Acer Aspire laptop.
 >> Arrival-Date:   Wed Oct 27 04:00:01 GMT 2010
 > 
 
 Hi again,
 
 I realize now this was essentially a feature request, but I'm wondering
 if anyone is playing with this at all?
 
 Alternatively, is anyone aware of some published documentation that
 outlines the differences between AMD K8/K10 PowerNow/Cool'n'Quiet?
 
 What changes are required to implement support for this on OpenBSD?
 
 Thanks,
 -Bryan.



Re: kernel/6501: CPU frequency scaling on AMD K10/Acer Aspire laptop.

2011-01-30 Thread Brynet
> On 10/27/10 00:05, gn...@cvs.openbsd.org wrote:
>> Thank you very much for your problem report.
>> It has the internal identification `kernel/6501'.
>> The individual assigned to look at your
>> report is: bugs. 
>> 
>>> Category:   kernel
>>> Responsible:bugs
>>> Synopsis:   CPU frequency scaling on AMD K10/Acer Aspire laptop.
>>> Arrival-Date:   Wed Oct 27 04:00:01 GMT 2010
>> 
> 
> Hi again,
> 
> I realize now this was essentially a feature request, but I'm wondering
> if anyone is playing with this at all?
> 
> Alternatively, is anyone aware of some published documentation that
> outlines the differences between AMD K8/K10 PowerNow/Cool'n'Quiet?
> 
> What changes are required to implement support for this on OpenBSD?
> 
> Thanks,
> -Bryan.

Hello, once again,

I finally sat down this weekend and started reading the datasheets
(K10/11 BKDG) and I believe I've got things working for these processors.

It's not perfect, but it works, at least manually using sysctl
hw.setperf and watching km0.temp and visually seeing performance changes
in several apps like openssl/glxgears.

I don't believe I have the delay right after the MSR write, and maybe
the developers would have preferred k8-powernow.c be extended.

If you want to silence the noise, change the #ifdef 1 to 0 in
k1x_transition()..

You can see a list of speeds gathered from ACPI tables using by grepping
for cpu0 in the dmesg.

I've only tested on a dual-core laptop, not tested on systems with 2
physical processors (..with multiple cores each).

Any opinions?

-Bryan.

--- /dev/null   Mon Jan 31 00:06:58 2011
+++ arch/amd64/amd64/k1x-pstate.c   Sun Jan 30 23:53:38 2011
@@ -0,0 +1,254 @@
+/* $OpenBSD$ */
+/*
+ * Copyright (c) 2011 Brynet 
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/* AMD K10/K11 pstate driver */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include "acpicpu.h"
+
+#if NACPICPU > 0
+#include 
+#include 
+#endif
+
+extern int setperf_prio;
+extern int perflevel;
+
+#define MSR_K1X_LIMIT  0xc0010061
+#define MSR_K1X_CONTROL0xc0010062
+#define MSR_K1X_STATUS 0xc0010063
+#define MSR_K1X_CONFIG 0xc0010064
+
+/* MSR_K1X_LIMIT */
+#define K1X_PSTATE_MAX_VAL(x)  (((x) >> 4) & 0x7)
+#define K1X_PSTATE_LIMIT(x)(((x)) & 0x7)
+
+/* MSR_K1X_CONFIG */
+#define K1X_FID(x) ((x) & 0x3f)
+#define K1X_DID(x) (((x) >> 6) & 0x07)
+
+/* Maximum pstates */
+#define K1X_MAX_STATES 16
+
+struct k1x_state {
+   int freq;
+   u_int8_t fid;
+};
+
+struct k1x_cpu_state {
+   struct k1x_state state_table[K1X_MAX_STATES];
+   u_int n_states;
+};
+
+struct k1x_cpu_state *k1x_current_state;
+
+void k1x_transition(struct k1x_cpu_state *, int);
+
+#if NACPICPU > 0
+void k1x_acpi_init(struct k1x_cpu_state *, u_int64_t);
+void k1x_acpi_pss_changed(struct acpicpu_pss *, int);
+int k1x_acpi_states(struct k1x_cpu_state *, struct acpicpu_pss *, int,
+u_int64_t);
+#endif
+
+void
+k1x_setperf(int level)
+{
+   u_int i = 0;
+   struct k1x_cpu_state *cstate;
+
+   cstate = k1x_current_state;
+
+   i = ((level * cstate->n_states) + 1) / 101;
+   if (i >= cstate->n_states)
+   i = cstate->n_states - 1;
+
+   k1x_transition(cstate, i);
+}
+
+void
+k1x_transition(struct k1x_cpu_state *cstate, int level) {
+   u_int64_t msr;
+   int i, cfid, fid = cstate->state_table[level].fid;
+
+   msr = rdmsr(MSR_K1X_STATUS);
+   cfid = K1X_FID(m

Re: kernel/6501: CPU frequency scaling on AMD K10/Acer Aspire laptop.

2011-01-30 Thread Brynet
The following reply was made to PR kernel/6501; it has been noted by GNATS.

From: Brynet 
To: gn...@cvs.openbsd.org, b...@cvs.openbsd.org
Cc: t...@openbsd.org
Subject: Re: kernel/6501: CPU frequency scaling on AMD K10/Acer Aspire laptop.
Date: Mon, 31 Jan 2011 01:03:40 -0500

 > On 10/27/10 00:05, gn...@cvs.openbsd.org wrote:
 >> Thank you very much for your problem report.
 >> It has the internal identification `kernel/6501'.
 >> The individual assigned to look at your
 >> report is: bugs. 
 >> 
 >>> Category:   kernel
 >>> Responsible:bugs
 >>> Synopsis:   CPU frequency scaling on AMD K10/Acer Aspire laptop.
 >>> Arrival-Date:   Wed Oct 27 04:00:01 GMT 2010
 >> 
 > 
 > Hi again,
 > 
 > I realize now this was essentially a feature request, but I'm wondering
 > if anyone is playing with this at all?
 > 
 > Alternatively, is anyone aware of some published documentation that
 > outlines the differences between AMD K8/K10 PowerNow/Cool'n'Quiet?
 > 
 > What changes are required to implement support for this on OpenBSD?
 > 
 > Thanks,
 > -Bryan.
 
 Hello, once again,
 
 I finally sat down this weekend and started reading the datasheets
 (K10/11 BKDG) and I believe I've got things working for these processors.
 
 It's not perfect, but it works, at least manually using sysctl
 hw.setperf and watching km0.temp and visually seeing performance changes
 in several apps like openssl/glxgears.
 
 I don't believe I have the delay right after the MSR write, and maybe
 the developers would have preferred k8-powernow.c be extended.
 
 If you want to silence the noise, change the #ifdef 1 to 0 in
 k1x_transition()..
 
 You can see a list of speeds gathered from ACPI tables using by grepping
 for cpu0 in the dmesg.
 
 I've only tested on a dual-core laptop, not tested on systems with 2
 physical processors (..with multiple cores each).
 
 Any opinions?
 
 -Bryan.
 
 --- /dev/null  Mon Jan 31 00:06:58 2011
 +++ arch/amd64/amd64/k1x-pstate.c  Sun Jan 30 23:53:38 2011
 @@ -0,0 +1,254 @@
 +/*$OpenBSD$ */
 +/*
 + * Copyright (c) 2011 Brynet 
 + *
 + * Redistribution and use in source and binary forms, with or without
 + * modification, are permitted provided that the following conditions
 + * are met:
 + * 1. Redistributions of source code must retain the above copyright
 + *notice, this list of conditions and the following disclaimer.
 + * 2. Redistributions in binary form must reproduce the above copyright
 + *notice, this list of conditions and the following disclaimer in the
 + *documentation and/or other materials provided with the distribution.
 + *
 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 WARRANTIES
 + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 USE,
 + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 + */
 +/* AMD K10/K11 pstate driver */
 +
 +#include 
 +#include 
 +#include 
 +#include 
 +#include 
 +#include 
 +
 +#include 
 +#include 
 +#include 
 +
 +#include "acpicpu.h"
 +
 +#if NACPICPU > 0
 +#include 
 +#include 
 +#endif
 +
 +extern int setperf_prio;
 +extern int perflevel;
 +
 +#define MSR_K1X_LIMIT 0xc0010061
 +#define MSR_K1X_CONTROL   0xc0010062
 +#define MSR_K1X_STATUS0xc0010063
 +#define MSR_K1X_CONFIG0xc0010064
 +
 +/* MSR_K1X_LIMIT */
 +#define K1X_PSTATE_MAX_VAL(x) (((x) >> 4) & 0x7)
 +#define K1X_PSTATE_LIMIT(x)   (((x)) & 0x7)
 +
 +/* MSR_K1X_CONFIG */
 +#define K1X_FID(x)((x) & 0x3f)
 +#define K1X_DID(x)(((x) >> 6) & 0x07)
 +
 +/* Maximum pstates */
 +#define K1X_MAX_STATES16
 +
 +struct k1x_state {
 +  int freq;
 +  u_int8_t fid;
 +};
 +
 +struct k1x_cpu_state {
 +  struct k1x_state state_table[K1X_MAX_STATES];
 +  u_int n_states;
 +};
 +
 +struct k1x_cpu_state *k1x_current_state;
 +
 +void k1x_transition(struct k1x_cpu_state *, int);
 +
 +#if NACPICPU > 0
 +void k1x_acpi_init(struct k1x_cpu_state *, u_int64_t);
 +void k1x_acpi_pss_changed(struct acpicpu_pss *, int);
 +int k1x_acpi_states(struct k1x_cpu_state *, struct acpicpu_pss *, int,
 +u_int64_t);
 +#endif
 +
 +void
 +k1x_setperf(int level)
 +{
 +  u_int i = 0;
 +  struct k1x_cpu_state *cstate;
 +
 +  cst